Page 1 of 1

Synology bug - will not open web page

Posted: June 7th, 2017, 6:58 am
by coops
Sabnzbd is great - but I thought i'd mention an intermittent bug that seems to have arrived since vers 2, and is still an occasional problem with the latest 2.0.1-26 - on a Synology 412+ running DSM 6.1 ( DSM 6.1.1-15101 Update 4, the latest).

Sometimes, but not always, after turning on the Synology I get the following error message when trying to view Sabnzbd :-

The server encountered an unexpected condition which prevented it from fulfilling the request.
Traceback (most recent call last):
File "/volume1/@appstore/sabnzbd/share/SABnzbd/cherrypy/_cprequest.py", line 670, in respond
response.body = self.handler()
File "/volume1/@appstore/sabnzbd/share/SABnzbd/cherrypy/lib/encoding.py", line 220, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/volume1/@appstore/sabnzbd/share/SABnzbd/cherrypy/_cpdispatch.py", line 60, in __call__
return self.callable(*self.args, **self.kwargs)
File "/volume1/@appstore/sabnzbd/share/SABnzbd/sabnzbd/interface.py", line 358, in index
bytespersec_list = BPSMeter.do.get_bps_list()
File "/volume1/@appstore/sabnzbd/share/SABnzbd/sabnzbd/bpsmeter.py", line 322, in get_bps_list
self.add_empty_time()
File "/volume1/@appstore/sabnzbd/share/SABnzbd/sabnzbd/bpsmeter.py", line 285, in add_empty_time
self.bps_list.extend([0] * nr_diffs)
MemoryError



NOTE - ALSO..... stopping and then restarting Sabnzbd fixes the issue - it is then accessible entirely as usual. ALSO - on my iPad I have an 'whatsab' installed, & when the error is 'active' ( ie before stopping & restarting) I WAS able to send an NZB file to Sabnzbd, which seemed to start downloading ( looking at the info on the whatsab app).... & further, AFTER sending this nzb to Sab, I was then able to access Sabnzbd as usual from the Synology DSM webpage.

Re: Synology bug - will not open web page

Posted: June 7th, 2017, 8:35 am
by sander

Code: Select all

self.bps_list.extend([0] * nr_diffs)
MemoryError
So ... that extend() is consuming too much memory?

Can we emulate that?

Code: Select all

>>> mylist = [1,2]
>>> mylist.extend([0] * 10 )
>>> mylist
[1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]



>>> import sys
>>> mylist.extend([0] * sys.maxint  )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
MemoryError

Yes, there it is!

So nr_diffs is too big?

Code: Select all

>>> mylist.extend([0] * 2147483647  )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
MemoryError
>>> mylist.extend([0] * 214748364  )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
MemoryError
>>>
>>> mylist.extend([0] * 21474836  )
>>>
So: 21.474.836 is OK on my machine, and 214.748.364 (10 times bigger) is too big. Thus nr_diffs is somewhere in that region? Looks big to me.

Relevant code:

Code: Select all

    def add_empty_time(self):
        nr_diffs = int(time.time() - self.speed_log_time)
        if nr_diffs > 1:
            self.bps_list.extend([0] * nr_diffs)
On each webpage login and F5-refresh, the nr_diffs is higher than before:

Code: Select all

2017-06-07 15:52:47,185::INFO::[bpsmeter:284] SJ: nr_diffs is 101
2017-06-07 15:53:36,468::INFO::[bpsmeter:284] SJ: nr_diffs is 150
2017-06-07 15:53:42,281::INFO::[bpsmeter:284] SJ: nr_diffs is 156
2017-06-07 15:54:41,435::INFO::[bpsmeter:284] SJ: nr_diffs is 215
2017-06-07 15:58:15,769::INFO::[bpsmeter:284] SJ: nr_diffs is 429
2017-06-07 15:58:25,356::INFO::[bpsmeter:284] SJ: nr_diffs is 439
2017-06-07 15:58:26,752::INFO::[bpsmeter:284] SJ: nr_diffs is 440
2017-06-07 15:58:30,812::INFO::[bpsmeter:284] SJ: nr_diffs is 444
2017-06-07 16:04:12,003::INFO::[bpsmeter:284] SJ: nr_diffs is 785
2017-06-07 16:07:17,552::INFO::[bpsmeter:284] SJ: nr_diffs is 971
2017-06-07 16:12:35,562::INFO::[bpsmeter:284] SJ: nr_diffs is 1289


Re: Synology bug - will not open web page

Posted: June 7th, 2017, 11:28 am
by safihre
This is a nice bug, I like it :D
Because it's my fault: I never thought of a situation like this could happen when the last BPS measurement was very long ago, so long that it could cause problems.

Let me fix this!

Re: Synology bug - will not open web page

Posted: June 7th, 2017, 11:35 am
by safihre
Fixed it.
Will be in 2.0.1 Final.

Re: Synology bug - will not open web page

Posted: June 7th, 2017, 1:36 pm
by Cpuroast
I assume you mean 2.1.0 Final as 2.0.1 is already out and about :)

Re: Synology bug - will not open web page

Posted: June 7th, 2017, 2:07 pm
by safihre
Oh yes :D Sorry, 2.1.0

Re: Synology bug - will not open web page

Posted: June 7th, 2017, 10:16 pm
by coops
ok - thanks!

Glad to have found a 'nice bug' !

Learnt and made an app for myself in Swift... so a bug with an easily identifiable and fixable bug is 'nice' i suppose ;-)