Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toolbar Menu not showing #47

Closed
newash opened this issue Nov 16, 2017 · 11 comments
Closed

Toolbar Menu not showing #47

newash opened this issue Nov 16, 2017 · 11 comments

Comments

@newash
Copy link

newash commented Nov 16, 2017

Versions

OS: Xubuntu 16.04

Browser and version: FF57 (was also in 56)

DSM version: DSM 5.2-5967 Update 6 (was also with Update 5)

Download Station version: 3.5-2985

Steps to Reproduce the Issue

  1. I click on the toolbar icon
  2. Instead of the menu, only this shows:

synoextension

It seems to be a very general issue, but since no one reported it so far, I guess I'm doing something wrong...

@seansfkelley
Copy link
Owner

Thanks for taking the time to file an issue! I realize my issue template forgot to ask -- what version of the extension is this?

I've seen something like this occasionally and have had difficulty tracking it down. Does this happen often/always? Does it work if you give it a couple seconds and/or close/reopen the popup, or is it just broken forever?

@newash
Copy link
Author

newash commented Nov 16, 2017

Hey.
It's 0.3.1 now.

And it's like that since I installed the addon a couple of months ago. (I replaced SynoLoader addon with yours, since that is legacy kind.) It's showing the download task number on the icon, and new download tasks can be added through the context menu, but that's it. The menu never shows.
I don't even know how it supposed to look like. 🤔

@seansfkelley
Copy link
Owner

Huh, that's very strange. I've just published a new version (0.4.0) today that should improve the error handling for this -- if it hits an unrecoverable/unknown error, it'll display an "uh oh everything is a disaster" page with some debugging information. When you have a chance can you give the new version a try and see if it shows you something useful?

@newash
Copy link
Author

newash commented Nov 18, 2017

No problem! Here is the debug info:

TypeError: 'n.toFixed is not a function'
Error stack trace: renderString@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:32820:23
formatMetric1024@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:32825:20
renderStatus@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:32893:20
render@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:32868:65
finishClassComponent@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:14329:22
updateClassComponent@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:14306:12
beginWork@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:14685:16
performUnitOfWork@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:16653:16
workLoop@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:16762:28
callCallback@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:5379:9
invokeGuardedCallbackDev@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:5418:7
invokeGuardedCallback@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:5275:5
performWork@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:16880:7
scheduleUpdateImpl@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:17265:19
scheduleUpdate@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:17204:12
scheduleTopLevelUpdate@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:17475:5
updateContainer@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:17505:7
renderSubtreeIntoContainer/<@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:21185:7
unbatchedUpdates@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:17336:14
renderSubtreeIntoContainer@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:21184:5
render@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:21209:12
@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:33285:13
fetchStateAndNotify/</<@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:31619:32
fetchStateAndNotify/<@moz-extension://bc848a4d-fa80-4a54-b685-cdc37b849bbb/dist/js/popup.js:31619:9

React stack trace:
    in Task$1 (created by Popup)
    in ul (created by Popup)
    in div (created by Popup)
    in div (created by Popup)
    in div (created by Popup)
    in Popup
    in FatalErrorWrapper

I guess it would be nice seeing that number attribute that is not a number...

@seansfkelley
Copy link
Owner

seansfkelley commented Nov 18, 2017

Looks like the problematic call is passing task.additional.transfer.size_uploaded, which, judging by the error message, exists but isn't a Number and so doesn't have toFixed.

I notice you have DSM 5, so it's conceivable that your NAS is returning (e.g.) a number in string form (or something else entirely), though I've hardcoded the API versions I use so that would be a proper bug on Synology's part if my NAS behaved differently from yours there. The documentation for the GetInfo API call I'm using does use stringified numbers for some of the "size" values in the examples, but inspecting what my NAS actually returns shows numerical values, not strings. The documentation has been wrong before.

If you want to see something, you could try opening the settings and hiding "completed, uploading" tasks from view as they seem to have the problematic value (though I suppose tasks in other states could also exhibit this problem, and hiding all task types isn't terribly useful).

Do you know if the tasks you're seeding are very small, specifically, less than 1024 bytes? (Greater than that and this divide operation would change the type of n to a number and sidestep the issue entirely, so... thanks Javascript?).

EDIT: Actually, the size of the task doesn't matter. What matters is if you've only uploaded less than 1024 bytes, which is entirely possible with any task.

@newash
Copy link
Author

newash commented Nov 18, 2017

First, thanks for the lengthy explanation.

I have both downloading and seeding tasks with 0 uploaded bytes. So the menu only works if I disable all task types. 😄 If you can help me how, I'd be happy to dig out whatever data my NAS sends.

What is still weird though, that no one else reported this issue.

@seansfkelley
Copy link
Owner

Agreed it is weird, which is part of why I'm thinking that it might be a DSM 5 thing. I appreciate you offering to help! This would be extraordinarily hard to debug otherwise since I don't have access to DSM 5.

If you're willing to take a journey into the Firefox dev tools, the information I need can be found by doing the following:

  1. Open about:debugging in a new tab.
  2. Check the "Enable add-on debugging" checkbox at the top.
  3. Find Synology Download Manager in the list and hit "debug". Firefox should open another Firefox instance (accept the warning popup it gives you).
  4. Along the top of the new Developer Tools window, click the Network tab.
  5. If the list there isn't empty, I suggest you empty it by clicking the trash can icon by the top left (makes it easier to find what you're looking for).
  6. Open the Synology Download Manager popup, which will cause it to load tasks. Close it once the spinner stops.
  7. In the Developer Tools window, you should see a list item that has a value starting with task.cgi under the File column. Right-click that, and it should have a Copy > Copy Response option.
  8. Paste that response here or in a gist so I can take a look at it!

pasted_image_11_18_17__12_47

@newash
Copy link
Author

newash commented Nov 18, 2017

Here it is, cleaned & formatted.

{
  "data":{
    "offeset":0,
    "tasks":[
      {
        "additional":{
          "detail":{
            "connected_leechers":0,
            "connected_seeders":0,
            "create_time":"1491422337",
            "destination":"download",
            "priority":"auto",
            "total_peers":0,
            "uri":"xxxxxxxxxxxxxxxxxxxxx.torrent"
          },
          "transfer":{
            "size_downloaded":"0",
            "size_uploaded":"0",
            "speed_download":0,
            "speed_upload":0
          }
        },
        "id":"dbid_2773",
        "size":"2411334039",
        "status":"downloading",
        "status_extra":null,
        "title":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "type":"bt",
        "username":"admin"
      },
      {
        "additional":{
          "detail":{
            "connected_leechers":0,
            "connected_seeders":0,
            "create_time":"1510448409",
            "destination":"download",
            "priority":"auto",
            "total_peers":0,
            "uri":"magnet:?xt=urn:btih:1a322exxxxxxxxxxxxxxxxxxxx"
          },
          "transfer":{
            "size_downloaded":"267047174",
            "size_uploaded":"0",
            "speed_download":0,
            "speed_upload":0
          }
        },
        "id":"dbid_3436",
        "size":"604639494",
        "status":"downloading",
        "status_extra":null,
        "title":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "type":"bt",
        "username":"admin"
      },
      {
        "additional":{
          "detail":{
            "connected_leechers":0,
            "connected_seeders":0,
            "create_time":"1510606025",
            "destination":"download",
            "priority":"auto",
            "total_peers":0,
            "uri":"6a070ed2d69796eeb7c8a14594b29495.torrent"
          },
          "transfer":{
            "size_downloaded":"0",
            "size_uploaded":"0",
            "speed_download":0,
            "speed_upload":0
          }
        },
        "id":"dbid_3446",
        "size":"131418360",
        "status":"downloading",
        "status_extra":null,
        "title":"6a070ed2d69796eeb7c8a14594b29495",
        "type":"bt",
        "username":"admin"
      },
      {
        "additional":{
          "detail":{
            "connected_leechers":0,
            "connected_seeders":0,
            "create_time":"1510849245",
            "destination":"download",
            "priority":"auto",
            "total_peers":0,
            "uri":"bab6ce7ef8a3380da674397d50815c41.torrent"
          },
          "transfer":{
            "size_downloaded":"201631352",
            "size_uploaded":"87783002",
            "speed_download":0,
            "speed_upload":0
          }
        },
        "id":"dbid_3451",
        "size":"201631352",
        "status":"seeding",
        "status_extra":null,
        "title":"bab6ce7ef8a3380da674397d50815c41",
        "type":"bt",
        "username":"admin"
      },
      {
        "additional":{
          "detail":{
            "connected_leechers":0,
            "connected_seeders":0,
            "create_time":"1510849245",
            "destination":"download",
            "priority":"auto",
            "total_peers":0,
            "uri":"4cf4002f00f31d52cb9540284d839cee.torrent"
          },
          "transfer":{
            "size_downloaded":"162133184",
            "size_uploaded":"0",
            "speed_download":0,
            "speed_upload":0
          }
        },
        "id":"dbid_3452",
        "size":"162133184",
        "status":"seeding",
        "status_extra":null,
        "title":"4cf4002f00f31d52cb9540284d839cee",
        "type":"bt",
        "username":"admin"
      },
      {
        "additional":{
          "detail":{
            "connected_leechers":0,
            "connected_seeders":0,
            "create_time":"1510953043",
            "destination":"download",
            "priority":"auto",
            "total_peers":0,
            "uri":"137bf27953d8d246388d5238ccda4946.torrent"
          },
          "transfer":{
            "size_downloaded":"180797064",
            "size_uploaded":"57274721",
            "speed_download":0,
            "speed_upload":0
          }
        },
        "id":"dbid_3453",
        "size":"180797064",
        "status":"seeding",
        "status_extra":null,
        "title":"137bf27953d8d246388d5238ccda4946",
        "type":"bt",
        "username":"admin"
      },
      {
        "additional":{
          "detail":{
            "connected_leechers":0,
            "connected_seeders":0,
            "create_time":"1510953044",
            "destination":"download",
            "priority":"auto",
            "total_peers":0,
            "uri":"a2f507a209b4d9b0a37de3c3f2ca7b32.torrent"
          },
          "transfer":{
            "size_downloaded":"155822392",
            "size_uploaded":"0",
            "speed_download":0,
            "speed_upload":0
          }
        },
        "id":"dbid_3454",
        "size":"155822392",
        "status":"seeding",
        "status_extra":null,
        "title":"a2f507a209b4d9b0a37de3c3f2ca7b32",
        "type":"bt",
        "username":"admin"
      },
      {
        "additional":{
          "detail":{
            "connected_leechers":0,
            "connected_seeders":0,
            "create_time":"1511037695",
            "destination":"download",
            "priority":"auto",
            "total_peers":0,
            "uri":"magnet:?xt=urn:btih:4bcxxxxxxxxxxxxxxxxxxxxxxxxxxx"
          },
          "transfer":{
            "size_downloaded":"0",
            "size_uploaded":"0",
            "speed_download":0,
            "speed_upload":0
          }
        },
        "id":"dbid_3455",
        "size":"0",
        "status":"downloading",
        "status_extra":null,
        "title":"xxxxxxxxxxxxxxxxxxxxxxxx",
        "type":"bt",
        "username":"admin"
      }
    ],
    "total":8
  },
  "success":true
}

BTW: While it's DSM5, it's actually the latest update of that (had some security patch a few days ago), so I'd say it still part of the supported line. I'm running some extra services using ipgk and afraid to update to DSM6. 😊

@seansfkelley
Copy link
Owner

Yup, so it looks like this is a legitimate bug in DSM: you and I are using the the same version of the same API call, but I'm getting numerical types and you're sometimes getting strings, and it's not even self-consistent:

"transfer":{
  "size_downloaded":"0",
  "size_uploaded":"0",
  "speed_download":0,
  "speed_upload":0
}

(FWIW, the docs do say it should be a string, but this is the first I've ever seen that.)

This should be easy to fix; it just requires special-casing this call to parse those strings into numbers.

seansfkelley pushed a commit to seansfkelley/synology-typescript-api that referenced this issue Nov 20, 2017
…or some values.

See seansfkelley/nas-download-manager#47, where
it was determined that the same API call + version combination yields different
results (in terms of numbers being numbers or strings) between DSM versions, i.e.,
I'm working around a Synology bug.
@newash
Copy link
Author

newash commented Nov 20, 2017

Confirmed, works, thanks a million!

@seansfkelley
Copy link
Owner

Excellent, and thanks for helping debug!

@seansfkelley seansfkelley mentioned this issue Nov 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants