dell / dell/pike

pike with python multiprocessing fails with "OSError: [Errno 9] Bad file descriptor"

Open
#38 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
39
Forks
43
PR merge metrics
No merged PRs in 30d

Description

Hi,

i could see the pike is not working when i use it with python multiprocessing module.

i am using pike version '0.2.7'

my requirements is to create multiple process to establish the connection and send smb requests to my server.

following are my observations:
**1. Without multiprocessing:**
`
>>> import pike.model
>>> import multiprocessing
>>>
>>> def test():
... client = pike.model.Client()
... connection = client.connect("127.0.0.1", 445).negotiate()
... channel = connection.session_setup("ISI\\root%a")
... tree = channel.tree_connect("TestShare")
... print("IT WORKED...")
...
>>>
>>> test()
IT WORKED...
>>>
`

**2. with multiprocessing:**
`
>>> class Test(multiprocessing.Process):
... def __init__(self):
... multiprocessing.Process.__init__(self)
...
... def run(self):
... client = pike.model.Client()
... connection = client.connect("127.0.0.1", 445).negotiate()
... channel = connection.session_setup("**********") # intentionaly putting * here :-)
... tree = channel.tree_connect("TestShare")
...
>>>
>>> Test().start()

ERROR OUTPUT HERE:
>>> Process Test-34:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
File "", line 7, in run
File "/var/crash/tools/lib/python2.7/site-packages/pike/model.py", line 327, in connect
return self.connect_submit(server, port).result()
File "/var/crash/tools/lib/python2.7/site-packages/pike/model.py", line 339, in connect_submit
return Connection(self, server, port).connection_future
File "/var/crash/tools/lib/python2.7/site-packages/pike/model.py", line 499, in __init__
self.create_socket(family, socktype)
File "/var/crash/tools/lib/python2.7/site-packages/pike/transport.py", line 74, in create_socket
self.set_socket(sock)
File "/var/crash/tools/lib/python2.7/site-packages/pike/transport.py", line 83, in set_socket
self.poller.add_channel(self)
File "/var/crash/tools/lib/python2.7/site-packages/pike/transport.py", line 349, in add_channel
self.kq.control(events, 0)
OSError: [Errno 9] Bad file descriptor
>>>
`

could any please take a look and let me know what is the wrong in it.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.