Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #66589 > unrolled thread
| Started by | Nikolaus Rath <Nikolaus@rath.org> |
|---|---|
| First post | 2014-02-16 22:35 -0800 |
| Last post | 2014-02-17 08:04 -0500 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
select(sock) indicates not-ready, but sock.recv does not block Nikolaus Rath <Nikolaus@rath.org> - 2014-02-16 22:35 -0800
Re: select(sock) indicates not-ready, but sock.recv does not block Roy Smith <roy@panix.com> - 2014-02-17 08:04 -0500
| From | Nikolaus Rath <Nikolaus@rath.org> |
|---|---|
| Date | 2014-02-16 22:35 -0800 |
| Subject | select(sock) indicates not-ready, but sock.recv does not block |
| Message-ID | <mailman.7083.1392618926.18130.python-list@python.org> |
Hello,
I have a problem with using select. I can reliably reproduce a situation
where select.select((sock.fileno(),), (), (), 0) returns ((),(),())
(i.e., no data ready for reading), but an immediately following
sock.recv() returns data without blocking.
I am pretty sure that this is not a race condition. The behavor is 100%
reproducible, the program is single threaded, and even waiting for 10
seconds before the select() call does not change the result.
I'm running Python 3.3.3 under Linux 3.12.
Has anyone an idea what might be going wrong here?
Thanks,
-Nikolaus
--
Encrypted emails preferred.
PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C
»Time flies like an arrow, fruit flies like a Banana.«
[toc] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2014-02-17 08:04 -0500 |
| Message-ID | <roy-424605.08041317022014@news.panix.com> |
| In reply to | #66589 |
In article <mailman.7083.1392618926.18130.python-list@python.org>, Nikolaus Rath <Nikolaus@rath.org> wrote: > Hello, > > I have a problem with using select. I can reliably reproduce a situation > where select.select((sock.fileno(),), (), (), 0) returns ((),(),()) > (i.e., no data ready for reading), but an immediately following > sock.recv() returns data without blocking. > > I am pretty sure that this is not a race condition. The behavor is 100% > reproducible, the program is single threaded, and even waiting for 10 > seconds before the select() call does not change the result. > > I'm running Python 3.3.3 under Linux 3.12. > > Has anyone an idea what might be going wrong here? > > Thanks, > -Nikolaus Can you post the code which demonstrates this? Also, with any kind of networking problem, tcpdump is your fried. When you run your code, use tcpdump to watch all the network traffic on whatever port your socket is bound to. That might give you some clues what's going on. Likewise, I would also strace the process and watch all the network system calls. The problem you're describing might be unexpected behavior in Python, or it might be in the kernel. Watching the actual system calls that are generated will narrow it down to which.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web