Brian Bouterse created QPID-5637:
------------------------------------
Summary: qpid.messaging Issues With Forking
Key: QPID-5637
URL: https://issues.apache.org/jira/browse/QPID-5637
Project: Qpid
Issue Type: Bug
Components: Python Client
Affects Versions: 0.24
Reporter: Brian Bouterse
Fix For: 0.27, 0.26, 0.24, 0.22, 0.18
qpid.messaging has an issue with forking in the following situation.
1. A parent Python process imports and uses qpid.messaging to connect to a a
Qpid broker
2. The parent process forks a child process
3. The child process imports qpid.messaging and tries to connect to a Qpid
broker.
I expected to see the child process use qpid.messaging normally as it would if
it weren't forked in the way described above. Instead, the server receives the
opening of a TCP socket, but the client never sends the AMQP protocol
announcement.
The root cause of this issue is in the file descriptors registered by the
Selector object inside of qpid.messaging. The Selector object uses a singleton
pattern to provide a reference to the same Selector object no matter how many
times you call it. This selector object already has registered file
descriptors with the filesystem, which allow the selector to read/write data in
an I/O efficient manner.
When forking occurs, the child process receives a copy of the Python running
space (ie: the Selector singleton), but the kernel is not registered with file
descriptors that are available in the child process' new file descriptor table.
This breaks usage of qpid.messaging in the client process because when
qpid.messaging relies on the epoll functionality of Selector, Selector does not
fulfill that expectation.
The solution is to have the class method that implements the singleton pattern
on the Selector object to be process aware, and implement the singleton pattern
per process.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]