Poller in link.loop() method + Windows

70 zobrazení
Přeskočit na první nepřečtenou zprávu

Jason Beyers

nepřečteno,
29. 3. 2013 14:28:4229.03.13
komu: sna...@googlegroups.com
Hi,

I've been working with SnakeMQ for a few days and it's working wonderfully on Linux, but I'm getting exceptions thrown in the loop() method of a link object on Windows, with the following traceback:

Traceback (most recent call last):
File "C:\Python27\lib\threading.py", line 551, in __bootstrap_inner
self.run()
File "snakemq_client.py", line 75, in run
self.my_link.loop(poll_timeout=self.poll_timeout, runtime=self.runtime)
File "C:\Users\Jason\Dropbox\Messaging\snakemq\link.py", line 410, in loop
is_event = len(self.poll(poll_timeout))
File "C:\Users\Jason\Dropbox\Messaging\snakemq\link.py", line 707, in poll
fds[:] = self.poller.poll(poll_timeout)
File "C:\Users\Jason\Dropbox\Messaging\snakemq\poll.py", line 49, in poll
fd = fd.fileno()
AttributeError: 'long' object has no attribute 'fileno'

I noticed some commits on github related to the windows poller and didn't see a
configuration for it mentioned in the docs - is there any way I can coerce the
select/poll mechanism to steer clear of file descriptor polling or is it more
complicated than that? I apologize I don't know much about the underlying
issues with Windows socket/fd polling.

I also notice this in poll.py:

if hasattr(select, "epoll"):
poll = select.epoll
else:
poll = SelectPoll

Any way I can force things to use epoll?

Any help would be greatly appreciated.

Thanks!
-Jason

David Široký

nepřečteno,
29. 3. 2013 15:34:0429.03.13
komu: sna...@googlegroups.com
Hi Jason!

this AttributeError is a bug, issue created (https://github.com/dsiroky/snakemq/issues/1). For a quick fix replace line 48

if not isinstance(fd, int):

with

if not isinstance(fd, (int, long)):



Regarding the poll - unfortunately MS Windows Python does not support poll/epoll (yet), only select, so there is the adaptation class SelectPoll for platforms without poll/epoll. And that is decided with the if hasattr(select, "epoll"). You don't have to enforce it. If it is present then it will be used.

David

Jason Beyers

nepřečteno,
29. 3. 2013 16:26:3529.03.13
komu: sna...@googlegroups.com
Quick fix works like a charm, thanks David!
Odpovědět všem
Odpověď autorovi
Přeposlat
0 nových zpráv