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

Sudden error in 4.2.0 version #42

Closed
turnmike2 opened this issue Apr 15, 2023 · 11 comments
Closed

Sudden error in 4.2.0 version #42

turnmike2 opened this issue Apr 15, 2023 · 11 comments
Assignees
Labels
DSM7 Synology DSM 7 setup It should work

Comments

@turnmike2
Copy link

turnmike2 commented Apr 15, 2023

Hi,

I am using the 4.2.0 version now a couple of weeks and the update mechanism is working very good.
But the last few days I receive an error in the first block (check for newer scripts) :

SYNO.PLEX UPDATE SCRIPT v4.2.0 for DSM 7

jq: error (at :1): Cannot index string with string "tag_name"
jq: error (at :1): Cannot index string with string "published_at"
jq: error (at :1): Cannot index string with string "body"
Script: syno.plexupdate.sh
Script Dir: /volume1/homes/admin/scripts
Running Ver: 4.2.0

  • No new version found

I did not alter or modify the script.And it was working ok till i guess last week. (errorred out on 13 april perhaps a date issue? )
The update function for plex works though. Any ideas what's wrong?
Mike

@michealespinola michealespinola self-assigned this Apr 18, 2023
@michealespinola michealespinola added DSM7 Synology DSM 7 setup It should work labels Apr 18, 2023
@michealespinola
Copy link
Owner

This is the version that I actively run, and I cannot replicate the error. This error is happening during the script self-update portion, and what you have provided is the extent of the error messages?

Which NAS model and version of DSM are you running the script on? I have been successfully testing with DS1019+ (x86_64), DSM 7.1.1-42962 Update 5. I was actually about to make v4.2.0 released/self-updatable now that DSM 7.1.1 Update 5 is publicly released.

If you've been running it for weeks but it has only errored in the past few days, I would try the following:

  1. Install and run a fresh copy of the script
  2. If that doesn't resolve the issue, try restarting your NAS

@turnmike2
Copy link
Author

Hmm..

Update and reboot fixed it.. Strange.

For completeness: on 13 april it suddenly happened. Complete log:
12 april:
Task: updateplex
Start time: Wed, 12 Apr 2023 03:00:01 GMT
Stop time: Wed, 12 Apr 2023 03:00:04 GMT
Current status: 0 (Normal)
Standard output/error:

SYNO.PLEX UPDATE SCRIPT v4.2.0 for DSM 7

Script: syno.plexupdate.sh
Script Dir: /volume1/homes/admin/scripts
Running Ver: 4.2.0
Online Ver: 4.1.0
Released: 2022-07-18 19:34:39+02:00 (267+ days old)

  • No new version found.

Synology: DS920+ (x86_64), DSM 7.1.1-42962 Update 4
Plex Dir: /volume1/PlexMediaServer/AppData/Plex Media Server
Running Ver: 1.31.3.6868
Online Ver: 1.32.0.6918 (Public Channel)
Released: 2023-04-06 19:16:58+02:00 (5+ days old)

  • Newer version found!

New Package: PlexMediaServer-1.32.0.6918-6f393eda1-x86_64_DSM7.spk
Package Age: 5+ days old (7+ required for install)

Update newer than 7 days - skipping..

13 april:
Task: updateplex
Start time: Thu, 13 Apr 2023 03:00:01 GMT
Stop time: Thu, 13 Apr 2023 03:00:04 GMT
Current status: 0 (Normal)
Standard output/error:

SYNO.PLEX UPDATE SCRIPT v4.2.0 for DSM 7

jq: error (at :1): Cannot index string with string "tag_name"
jq: error (at :1): Cannot index string with string "published_at"
jq: error (at :1): Cannot index string with string "body"
Script: syno.plexupdate.sh
Script Dir: /volume1/homes/admin/scripts
Running Ver: 4.2.0

  • No new version found.

Synology: DS920+ (x86_64), DSM 7.1.1-42962 Update 4
Plex Dir: /volume1/PlexMediaServer/AppData/Plex Media Server
Running Ver: 1.31.3.6868
Online Ver: 1.32.0.6918 (Public Channel)
Released: 2023-04-06 19:16:58+02:00 (6+ days old)

  • Newer version found!

New Package: PlexMediaServer-1.32.0.6918-6f393eda1-x86_64_DSM7.spk
Package Age: 6+ days old (7+ required for install)

Update newer than 7 days - skipping..

Update and reboot:

Task: updateplex
Start time: Tue, 18 Apr 2023 20:23:24 GMT
Stop time: Tue, 18 Apr 2023 20:23:27 GMT
Current status: 0 (Normal)
Standard output/error:

SYNO.PLEX UPDATE SCRIPT v4.2.0 for DSM 7

Script: syno.plexupdate.sh
Script Dir: /volume1/homes/admin/scripts
Running Ver: 4.2.0
Online Ver: 4.1.0
Released: 2022-07-18 19:34:39+02:00 (274+ days old)

  • No new version found.

Synology: DS920+ (x86_64), DSM 7.1.1-42962 Update 5
Plex Dir: /volume1/PlexMediaServer/AppData/Plex Media Server
Running Ver: 1.32.0.6918
Online Ver: 1.32.0.6950 (Public Channel)
Released: 2023-04-17 20:26:34+02:00 (0+ days old)

  • Newer version found!

New Package: PlexMediaServer-1.32.0.6950-8521b7d99-x86_64_DSM7.spk
Package Age: 0+ days old (7+ required for install)

Update newer than 7 days - skipping..

For now: it works (and it allready did. Only the check failed). Also the update of plex works)
Will close it now...

@michealespinola
Copy link
Owner

I'm glad to hear that the issue resolved itself and wasn't anything programmatic from my side of things, but this is something I continue to take seriously. I am not particularly happy when a reboot resolves an issue, and I will continue to do anything that I can to make the script resilient to issues like this.

I don't know if you have noticed from past issues, but other people have experienced odd bugs before that I cannot recreate and that resolve themselves after a reboot. They are thankfully rare and seemingly not recurring after a reboot, but they have happened. They typically involve the inability to properly process a date-related variable - so your issue here is novel, and I find that disturbing. I can only surmise that there is an underlying problem/bug with the shell service environment.

Thank you for providing the additional log detail. If you don't mind continuing this conversation just a little bit more: Would you tell me how long your Synology had been up/running before this issue started? Do you run any other shell scripts as recurring tasks?

Thanks,

@michealespinola michealespinola changed the title Sudden error in 4. 2.0 version Sudden error in 4.2.0 version Apr 18, 2023
@turnmike2
Copy link
Author

Sure to continue the story. Happy to share some thoughts...
(too bad the issue right now is resolved by rebooting the DS makes troublehooting further a bit difficult)

Some details:
The last reboot before the update today was Feb 16th.
Using your script since March 19th. So in somewhat 3 weeks it did not report any weird issues.

At first I suspected something like 13-04-2023 (normal date format in NL) to confuse it with 04-13-2023. Still this would have been noticed before starting the script (19 March).

For other scripts: Only have some "Hyper Backup" scripts. Nothing worth mentioning.

Could it be the jq is a bit buggy? (thinking out loud). I am not really into json or regex stuff. But whenever it tries to pull a string is erroring out, it might be usefull to do a but of debug logging (which is overwriting it with running the next run).
Might be easier to have something to put in github to debug.

Whenever you want more info from me tell me. Otherwise If you want me to test something, I can check it for you.

@michealespinola
Copy link
Owner

Thank you. I appreciate the info and willingness to help further troubleshoot. I can't recall personally seeing or receiving any reports of jq-related issues like this before (even when I was actively learning/developing the jq portion of the script). I really only ever use jq on my Synology NAS (for a few different scripts I run), but I've never seen this particular error before. I can't fathom why it randomly (and just you) would have this kind of JSON object issue - and why would a reboot resolve it (???).

Every once in a while I change how things are syntax'd in the script to make it more resilient/safer to glitches. I use linting tools and make revisions based on current best-practices for bash scripting to the best of my knowledge from books and commentary from various scripter/developer websites. Hopefully there is something I can similarly do with the jq syntax portions. Perhaps there is a more appropriate way that I should be capturing/iterating object data into strings. The problem ultimately is that without a repeatable issue, there is nothing to test and confirm against. I can only hope to never hear about the problem again.

Well, I've got some jq syntax best-practices to review. You make a good point about debug logging. I appreciate the conversation to help me re-engage into the development thought process. Thanks again,

@michealespinola
Copy link
Owner

The next script version (v4.3.0) will automatically create an output .log' file as well as an extended '.debug' file. Thank you for the brain storm. It was simple as well a pita to do at the same time, but I'm glad its done.

@turnmike2
Copy link
Author

And so every "bad" thing can be used for "good".

The culprit:

++ curl -m 900 -Ls 'https://api.github.com/repos/michealespinola/syno.plexupdate/releases?per_page=1'

It looks like too many github requests are killing the script at my side.
So this is not your problem anymore, but mine ;-)

In the end the debug saves the script. And whenever new issues occur, you can allways ask for debug log.
Thanks for the quick fix/respond! And keep up the good work.

@michealespinola
Copy link
Owner

Good with the bad indeed. My hours of trying to figure out that simultaneous debug output paid off. Redirections can be so quirky if your order of operations is not precise.

I had assumed that this kind of rate-limit issue would be obvious in other ways. I'm disappointed in myself for not realizing this might be a culprit here, and asking you how often you run the script. Sites like GitHub and Docker absolutely rate-limit, and they both have lower thresholds for rate-limiting against unauthenticated sessions.

Thankfully, I already have code I can implement that can catch/detect this kind of issue thanks to work I have been doing on another Plex-related script (the codec pre-loader). I will incorporate it into the update script as well so these kinds of issues will be more obvious in the future. You can learn a little bit more about the pre-loader script as outlined in the new/upcoming feature post #22.

I also have a Docker script I wrote that can pass credentials so it can make more connections. I honestly don't think that Plex needs nearly that level of update checking, but I'll look into how adaptable what I did for my Docker script might be for Plex.

Two questions: How often were you running the script? Did curl also return any specific HTTP status codes as well? 3xx, 4xx, 5xx, etc?

I'm going to re-open this issue until the curl error-trapping is complete and a new update is released.

Thanks,

@michealespinola
Copy link
Owner

Functionality has been added to the latest release version

@turnmike2
Copy link
Author

Thanks Michael.

Noticed this morning you created a new version.
In the end I discovered the issue coming from an integration in home-assistant checking github quite often.
Removed the check and voila working like a charm.

Thanks for your nice updater. Very happy I do not need to verify and see if updates are arriving.

@michealespinola
Copy link
Owner

From things I've learned along the way while working on adding this functionality: Unauthenticated GitHub connections are 60 per hour per IP. So, while I've got the unauthenticated basics done, I'm still working on working with Authenticated connections.

I imagine that for some of us (like you and me) that use things like HA and do various forms of update checking for multiple GitHub-based programs, that hitting the 60 might become an issue in the future.

I've already had to do similar with my Docker updating checking scripts (unauth is 100, and basic account auth bumps you up to 200).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DSM7 Synology DSM 7 setup It should work
Projects
None yet
Development

No branches or pull requests

2 participants