Skip to content

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

Description

@dinebhar

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions