Bug 1496846

Summary: Crash when using the same connection from two threads
Product: [oVirt] ovirt-engine-sdk-ruby Reporter: Juan Hernández <juan.hernandez>
Component: CoreAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED CURRENTRELEASE QA Contact: Radim Hrazdil <rhrazdil>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.1.8CC: bugs, lsvaty, lveyde
Target Milestone: ovirt-4.1.7Flags: rule-engine: ovirt-4.1+
ykaul: exception+
Target Release: 4.1.9   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-ovirt-engine-sdk4-4.1.9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-11-13 12:27:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Juan Hernández 2017-09-28 15:39:07 UTC
Description of problem:

Using the same connection from two threads causes a segmentation fault.

Version-Release number of selected component (if applicable):

4.1.8

How reproducible:

Always.

Steps to Reproduce:

Run the following program:

---8<---
#!/usr/bin/ruby
  
require 'ovirtsdk4'

# Create the connection to the server:
connection = OvirtSDK4::Connection.new(
  url: 'https://jenkins-vm-22.qa.lab.tlv.redhat.com/ovirt-engine/api',
  username: 'admin@internal',
  password: '123456'$q qp
  insecure: true,
  debug: true
)

events_service = connection.system_service.events_service

a = Thread.new do
  loop do
    events_service.list(max: 10)
  end
end

b = Thread.new do
  loop do
    events_service.list(max: 10)
  end
end

a.join
b.join

connection.close
--->8---

Actual results:

The program crashes with a segmentation fault.

Expected results:

The program should run without problems.

Additional info:

This happens because the way we use the underlying library, libcurl, doesn't support access by multiple threads.

Comment 1 Radim Hrazdil 2017-10-20 14:27:58 UTC
Verified that given program runs without crashing using SDK version 4.1.9.