This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: NNTPLib connections become corrupt after long periods of activity
Type: Stage:
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: James.Meneghello, jwilk, martin.panter, pitrou, r.david.murray
Priority: normal Keywords:

Created on 2014-05-10 16:23 by James.Meneghello, last changed 2022-04-11 14:58 by admin.

Messages (4)
msg218223 - (view) Author: James Meneghello (James.Meneghello) Date: 2014-05-10 16:23
After establishing an NNTP connection for a long-running process (up to hours at a time), the connection will eventually die and start producing infinite random garbage output, a small part of which is seen below. Any subsequent calls to the connection will produce a random stream of exceptions and data, as the library flips out. This happens with the connection being constantly used over the time period.

The problem occurs approximately 2 hours after the initial connection is established, and happens after approximately the same amount of time each run. The below connection was initialised at 22:03:27 and broke at 23:55:58.

Workaround is pretty simple: kill the connection and reinitialise it. Calling quit() will fail, however, with a series of random exceptions produced, because quit() attempts to send a QUIT command to the broken socket.

Tested on Ubuntu 13.10 (which fails) and Windows 8.1, which does not appear to have the same problem - I'm unable to replicate it on Win8.1.

--

2014-05-10 23:55:58,937 - ERROR - nntp error: <ɀ\udcd9?\udc95\udcf6Mo\udcdd0\udcb9\udcb9P0/)\udce4\udcbeBo\udc90q\udcb52\udc97\udcd7\udcf7f\udcacŸ\udcfa<    \udceaO2cC\udc92V\udcc1\udcc1ذ\ud,\udcdd\udcf1(\udc82>\udcbb\udc906Z4Ft<\udceeD\udcb5\udc9d\udcba\udcb5\udca8\udccaEk\udcfa\udcb6\udcc8\udcc1\udcf4yԫ\udce6\udccf\udcd8\udcc9_\udcf9c$\udc8cc֟c_B\udca9\udceefudcecsr<Cw+4\udc973\udce8\udceem\udc93\udcb4\udca1\udcd4\udc9f\udcb4\udcf1G\udcc1XI\udc9c\udcbc~\udcacK\udcbe\udc98\udcee־]I8\udc9f\udcac\udcc7\udcc6a\udcf58\udcdc-\udc93\udc82\udca6\udc90\udcf0\udcb5\udcf2\udcbeA?\udcf0\udc99:\udcb1\udc9e[\udcf9\udcfa`fvudcad\udcfa\udce7
-f\udcf8\udc81_$٫\udc8bH>\udcc1\udced�{\udc90\udca1\udcb2\udc81\udce0I\udc91\udcfeD\udceeE\udcd3\udcf6$\udccfbd\udcec"]\udcb0\udc9a\udc8cf6\udcfa\udcbf\udcea\udcb3h:S\udcbc\udc8dG\udca6t\udc85\udcc6(\udcf2\udce0Kb\udcbe\udcb8j\\udc94\udc85B-\udc9dL+le\udcad/.\udc87\udcbbtv\udc89!\udc8f/\udcf9_\udce0 \udcad\udc98\udcc0\udcc40T\udcc21\udcd3\udcebȳ
\udcbc@\udcf5mG\udcba\udca0\udcc2]۲LUخ\udcc0\udcc*\udce1,H6\udcccja\udcf9h\udc97f\udc95\udc9c\udce3\udc88%\udca7\udc860\udcfb\udc83\udca2\udca1\udccfH\udcd3Uxߴ\udce2\udc86өY\udcad\udcbb\udcd7\udcf7\udca7W㌘\udcf6\udcbf\udce9AI1P\udc8d\udc959^\udcc5\udcc3n\udce5xY\udcfb\udc87\udcfdp\udcb4nT\udca9\udc97\udcfbp\udc8aTkkb\udc90C\udcaa\udc8aq\udcddUm\udcd5sJsS7l\udcdb`\udc88hU\udcf6
msg219193 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-05-27 01:47
This is likely to be hard to reproduce (but perhaps someone will try). The best hope of getting it fixed is probably for you to investigate it yourself. 

Were you using ssl?  Also, have you tried all the python versions you selected, and if so, which exact versions?
msg219211 - (view) Author: James Meneghello (James.Meneghello) Date: 2014-05-27 07:58
Yeah, I didn't have a lot of time so I chose just to work around it. When I get a chance I'll have a better look.

Good point: I didn't think to try it with SSL off (SSL is enabled for all connections by default with this application). I'll test this and see if it still breaks.

I tested it with 3.2.5, 3.3.2, 3.4.0a (was the latest at the time) on Ubuntu 64-bit. As said, didn't encounter the same problems with those versions on Windows 8 64-bit.
msg226527 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2014-09-07 03:47
Perhaps this is similar to Issue 22350 which I just raised. Whenever the NNTP context manager exits, a QUIT command is called, and if the context manager is exiting due to a protocol error or some other exception not handled by the protocol, the code will try and read other protocol data as the QUIT response.

Perhaps your code was interrupted in the middle of reading a yEnc binary body and that is why it looks like garbage?
History
Date User Action Args
2022-04-11 14:58:03adminsetgithub: 65667
2014-09-07 03:47:32martin.pantersetnosy: + martin.panter
messages: + msg226527
2014-06-01 20:18:39jwilksetnosy: + jwilk
2014-05-27 07:58:03James.Meneghellosetmessages: + msg219211
2014-05-27 01:47:13r.david.murraysetnosy: + r.david.murray
messages: + msg219193
2014-05-16 18:54:23terry.reedysetnosy: + pitrou
2014-05-10 16:23:18James.Meneghellocreate