cwop service regularly timing out crash service module

16 views
Skip to first unread message

richar...@gmail.com

unread,
Oct 7, 2022, 1:38:14 PM10/7/22
to pywws
I have been using pywws for many years and it is rock solid.

However, I have recently noticed that the cwop service uploader is regularly timing out, I'm sure the problem is on their end, however the time out causes the service module to crash:

2022-10-07 16:06:23:pywws.service.cwop:timed out
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/pywws/service/__init__.py", line 180, in run
OK = self.upload_batch()
File "/usr/local/lib/python3.9/dist-packages/pywws/service/__init__.py", line 406, in upload_batch
with self.session() as session:
File "/usr/lib/python3.9/contextlib.py", line 117, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.9/dist-packages/pywws/service/cwop.py", line 105, in session
session.connect((server, 14580))
socket.timeout: timed out

My question is it possible for pywws to handle a non-responding more gracefully than crashing?

Thanks

Richard

Jim Easterbrook

unread,
Oct 8, 2022, 4:34:55 AM10/8/22
to py...@googlegroups.com
Is it crashing? I've had the same problem with CWOP timeouts - I wasn't
able to find a cause so I've stopped sending to CWOP. But pywws carries
on just fine after reporting that stack trace, as it is designed to do.

--
Jim Easterbrook <http://www.jim-easterbrook.me.uk/>

richar...@gmail.com

unread,
Oct 8, 2022, 4:52:14 AM10/8/22
to pywws
Dear Jim,

Thanks, I take your point that pywws isn't crashing, however, I thought perhaps the service handler for cwop was crashing and that it just wasn't taking down the whole of pywws.

Given that pywws keeps on going no change is necessary, I was just curious as to the cause of the stack trace really.

R

richar...@gmail.com

unread,
Oct 8, 2022, 3:19:03 PM10/8/22
to pywws
Dear Jim,

I've managed to 'fix' this by increasing the session.settimeout from 20 to 30 in cwop.py

I'm sure it'll still throw up the error from time to time, but increasing the timeout duration by 10 seconds seems to have greatly reduced the incidence.

R

Jim Easterbrook

unread,
Oct 9, 2022, 6:08:49 AM10/9/22
to py...@googlegroups.com
On 08/10/2022 20:19, richar...@gmail.com wrote:
>
> I've managed to 'fix' this by increasing the session.settimeout from 20
> to 30 in cwop.py

Doh! I didn't even think of trying that.

I've committed a group of changes to GitHub this morning that give
cleaner error logging when the timeout happens, and I've extended the
timeout to 60 seconds. If that doesn't fix it...

richar...@gmail.com

unread,
Oct 9, 2022, 6:54:13 AM10/9/22
to pywws
Thanks, that's great. I'm working off the pip version, so will test this as soon as you release this as a new version there.

As always thanks so much for the effort you put in to support this excellent utility.

R

richar...@gmail.com

unread,
Oct 10, 2022, 5:22:48 AM10/10/22
to pywws
Dear Jim,

I adapted my install to use your updated error handling code for cwop. When cwop fails to upload pywws logs the following error:
2022-10-10 09:22:09:pywws.service.cwop:AttributeError("'tuple' object has no attribute 'sendall'")

This seems a bit of a strange error to me, and doesn't appear to be a timeout error, could you shed any light on what is causing this, is it on their end or how pywws handles their failuure?

Thanks

Richard

Jim Easterbrook

unread,
Oct 10, 2022, 5:38:05 AM10/10/22
to py...@googlegroups.com
On 10/10/2022 10:22, richar...@gmail.com wrote:
>
> I adapted my install to use your updated error handling code for cwop.
> When cwop fails to upload pywws logs the following error:
> 2022-10-10 09:22:09:pywws.service.cwop:AttributeError("'tuple' object
> has no attribute 'sendall'")
>
> This seems a bit of a strange error to me, and doesn't appear to be a
> timeout error, could you shed any light on what is causing this, is it
> on their end or how pywws handles their failuure?

I suspect you've only implemented some of the changes I made in three
commits. Every service module has changed as the session() method now
returns a (session, message) tuple instead of a session object.

See
https://github.com/jim-easterbrook/pywws/commit/706e59fb9674d133c885c1ec937862b12cf4d7f8
for some of the changes.

richar...@gmail.com

unread,
Oct 10, 2022, 5:50:59 AM10/10/22
to pywws
Dear Jim,

You are of course correct, I only adapted cwop.py, however good to see even this doesn't crash pywws.

I'll revert the code and await the next release.

Thanks

Richard

Jim Easterbrook

unread,
Oct 10, 2022, 11:42:33 AM10/10/22
to py...@googlegroups.com
On 09/10/2022 11:07, Jim Easterbrook wrote:
>
> I've committed a group of changes to GitHub this morning that give
> cleaner error logging when the timeout happens, and I've extended the
> timeout to 60 seconds. If that doesn't fix it...

I've been investigating the CWOP timeouts and found that they only occur
in the initial 'session.connect()' call. If the connection succeeds it
usually does so immediately and the rest of the transaction is trouble free.

I'm now experimenting with going back to a 20 second timeout but
retrying the connect call a few times until it succeeds. This appears to
be behaving quite well so far.

richar...@gmail.com

unread,
Oct 10, 2022, 12:18:35 PM10/10/22
to pywws
Dear Jim,

Sounds excellent, I look forward to hearing the conclusions of your tests and if you'd be happy to include the changes into pywws.

R

Reply all
Reply to author
Forward
0 new messages