advplyr / audiobookshelf

Self-hosted audiobook and podcast server
https://audiobookshelf.org
GNU General Public License v3.0
5.75k stars 395 forks source link

[Bug]: Uncaught Exception stops server, and cannot be restarted without quitting tray and restarting. #2998

Open coreyemmons opened 1 month ago

coreyemmons commented 1 month ago

What happened?

Periodically, my server will stop and cannot be started again unless the tray application is exited and restarted. I checked the corresponding AudioBookShelf log, and there were no entries for the time specified, as well as three minutes before the incident.

What did you expect to happen?

Basically, I expected the system to not crash when it was idle. I don't know why it was looking for a file in the APPDATA\Temp directory.

Steps to reproduce the issue

  1. Unknown, as the server was idle at the time. I was browsing the internet on the machine, and it is also a Plex server, but as far as I know they should not conflict with one another.

Audiobookshelf version

2.9.0

How are you running audiobookshelf?

Windows Tray App

What OS is your Audiobookshelf server hosted from?

Windows

If the issue is being seen in the UI, what browsers are you seeing the problem on?

None

Logs

[Server] [2024-05-22 19:03:28.087] FATAL: [Server] Uncaught exception origin: uncaughtException, error: Error: ENOENT: no such file or directory, open 'C:\Users\<USER>\AppData\Local\Temp\pkg-wT8cRv\d37ed123d39404b70c20b9422e2946b3f9542e810059da08d495a9d67efed39b'
[Server]     at Object.openSync (node:fs:599:3)
[Server]     at Object.openSync (pkg/prelude/bootstrap.js:793:32)
[Server]     at uncompressExternallyAndOpen (pkg/prelude/bootstrap.js:748:19)
[Server]     at pkg/prelude/bootstrap.js:763:32
[Server]     at FSReqCallback.oncomplete (node:fs:201:23) {
[Server]   errno: -4058,
[Server]   syscall: 'open',
[Server]   code: 'ENOENT',
[Server]   path: 'C:\\Users\\<USER>\\AppData\\Local\\Temp\\pkg-wT8cRv\\d37ed123d39404b70c20b9422e2946b3f9542e810059da08d495a9d67efed39b'
[Server] } (    at process.<anonymous> (C:\snapshot\audiobookshelf\server\Server.js))
[Server] node:internal/fs/utils:347
[Server]     throw err;
[Server]     ^
[Server] Error: ENOENT: no such file or directory, open 'C:\Users\<USER>\AppData\Local\Temp\pkg-wT8cRv\d37ed123d39404b70c20b9422e2946b3f9542e810059da08d495a9d67efed39b'
[Server]     at Object.openSync (node:fs:599:3)
[Server]     at Object.openSync (pkg/prelude/bootstrap.js:793:32)
[Server]     at uncompressExternallyAndOpen (pkg/prelude/bootstrap.js:748:19)
[Server]     at pkg/prelude/bootstrap.js:763:32
[Server]     at FSReqCallback.oncomplete (node:fs:201:23) {
[Server]   errno: -4058,
[Server]   syscall: 'open',
[Server]   code: 'ENOENT',
[Server]   path: 'C:\\Users\\<USER>\\AppData\\Local\\Temp\\pkg-wT8cRv\\d37ed123d39404b70c20b9422e2946b3f9542e810059da08d495a9d67efed39b'
[Server] }
[Server] Node.js v18.5.0
[App   ] [2024-05-22 19:03:28.280] DEBUG: [AppTray] sender exit code: 1
[App   ] [2024-05-22 19:03:28.280] ERROR: [AppTray] Server exited with error code 1
[App   ] [2024-05-22 19:03:43.850] DEBUG: [AppTray] About to exit...
[App   ] [2024-05-22 19:03:43.850] DEBUG: [AppTray] Stopping server...
[App   ] [2024-05-22 19:03:43.850] DEBUG: [AppTray] Server stopped

Additional Notes

No response

advplyr commented 1 month ago

This probably belongs in https://github.com/mikiher/audiobookshelf-windows, I don't recognize that folder path.

@mikiher any thoughts on this one?

mikiher commented 1 month ago

I have not encountered a crash like this. It seems weird that this happens randomly while the server is idle. Can you please share the full log file? It is usually located at %LOCALAPPDATA%\AudiobookshelfTray\logfile.txt

coreyemmons commented 1 month ago

I can upload the full log tomorrow evening when I return from travel.

On Thu, May 23, 2024, 16:29 mikiher @.***> wrote:

I have not encountered a crash like this. It seems weird that this happens randomly while the server is idle. Can you please share the full log file? It is usually located at %LOCALAPPDATA%\AudiobookshelfTray\logfile.txt

— Reply to this email directly, view it on GitHub https://github.com/advplyr/audiobookshelf/issues/2998#issuecomment-2127966519, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJGJGS5TGXMBMKQZ3LRUOMDZDZGTDAVCNFSM6AAAAABIER6UXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRXHE3DMNJRHE . You are receiving this because you authored the thread.Message ID: @.***>

coreyemmons commented 1 month ago

Logfile attached logfile.txt

mikiher commented 1 month ago

OK, it looks like you have a periodic podcast check running every hour, but it didn't seem to have been running while the crash happened (the last check ended 3 minutes before the crash), so it doesn't seem likely that it's connected to it.

This crash happened internally in the pkg code (pkg is the component that bundles Node and the server into a windows executable and is responsible for loading and running it), and unfortunately it is hard to understand from the exception what happened, except that it was trying to access its temp directory and it didn't exist.

You said this happens periodically, however I only found one uncaught exception in the log. Did the server have additional crashes during the period covered by the log? How often does this happen?

coreyemmons commented 1 month ago

I believe it has happened three times since installation, which was about a month or so ago. I can look through the previous logs and see if there are more instances.

On Tue, May 28, 2024, 06:07 mikiher @.***> wrote:

OK, it looks like you have a periodic podcast check running every hour, but it didn't seem to have been running while the crash happened (the last check ended 3 minutes before the crash), so it doesn't seem likely that it's connected to it.

This crash happened internally in the pkg code (pkg is the component that bundles Node and the server into a windows executable and is responsible for loading and running it), and unfortunately it is hard to understand from the exception what happened, except that it was trying to access its temp directory and it didn't exist.

You said this happens periodically, however I only found one uncaught exception in the log. Did the server have additional crashes during the period covered by the log? How often does this happen?

— Reply to this email directly, view it on GitHub https://github.com/advplyr/audiobookshelf/issues/2998#issuecomment-2134836563, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJGJGS3QKZLSUTDGGBJTZD3ZERJO3AVCNFSM6AAAAABIER6UXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZUHAZTMNJWGM . You are receiving this because you authored the thread.Message ID: @.***>

advplyr commented 3 weeks ago

Any update on this?

coreyemmons commented 3 weeks ago

Thanks for the reminder. I just looked through the logs, and have found the following other instances:

[Server] [2024-05-09 15:52:32.647] INFO: [SocketAuthority] Socket g8zW0E8csf057Wk6AAAB disconnected from client "root" after 1234355160ms (Reason: transport close) [Server] [2024-05-09 15:52:59.765] FATAL: [Server] Uncaught exception origin: uncaughtException, error: Error: ENOENT: no such file or directory, open 'C:\Users\corey\AppData\Local\Temp\pkg-pbjgDk\63c2d1967c26bcce8507095dbed019eabe56ca034b6fb684c1c8539f8268e007' [Server] at Object.openSync (node:fs:599:3) [Server] at Object.openSync (pkg/prelude/bootstrap.js:793:32) [Server] at uncompressExternallyAndOpen (pkg/prelude/bootstrap.js:748:19) [Server] at pkg/prelude/bootstrap.js:763:32 [Server] at FSReqCallback.oncomplete (node:fs:201:23) { [Server] errno: -4058, [Server] syscall: 'open', [Server] code: 'ENOENT', [Server] path: 'C:\\Users\\corey\\AppData\\Local\\Temp\\pkg-pbjgDk\\63c2d1967c26bcce8507095dbed019eabe56ca034b6fb684c1c8539f8268e007' [Server] } ( at process.<anonymous> (C:\snapshot\audiobookshelf\server\Server.js)) [Server] node:internal/fs/utils:347 [Server] throw err; [Server] ^ [Server] Error: ENOENT: no such file or directory, open 'C:\Users\corey\AppData\Local\Temp\pkg-pbjgDk\63c2d1967c26bcce8507095dbed019eabe56ca034b6fb684c1c8539f8268e007' [Server] at Object.openSync (node:fs:599:3) [Server] at Object.openSync (pkg/prelude/bootstrap.js:793:32) [Server] at uncompressExternallyAndOpen (pkg/prelude/bootstrap.js:748:19) [Server] at pkg/prelude/bootstrap.js:763:32 [Server] at FSReqCallback.oncomplete (node:fs:201:23) { [Server] errno: -4058, [Server] syscall: 'open', [Server] code: 'ENOENT', [Server] path: 'C:\\Users\\corey\\AppData\\Local\\Temp\\pkg-pbjgDk\\63c2d1967c26bcce8507095dbed019eabe56ca034b6fb684c1c8539f8268e007' [Server] } [Server] [2024-04-21 16:13:31.703] FATAL: [Server] Uncaught exception origin: uncaughtException, error: Error: ENOENT: no such file or directory, open 'C:\Users\corey\AppData\Local\Temp\pkg-5rf78R\83edb02c6645e04d0ee9dfa46286f532453fe17d206b1f4a05f8c59b6220c86e' [Server] at Object.openSync (node:fs:599:3) [Server] at Object.openSync (pkg/prelude/bootstrap.js:793:32) [Server] at uncompressExternallyAndOpen (pkg/prelude/bootstrap.js:748:19) [Server] at pkg/prelude/bootstrap.js:763:32 [Server] at FSReqCallback.oncomplete (node:fs:201:23) { [Server] errno: -4058, [Server] syscall: 'open', [Server] code: 'ENOENT', [Server] path: 'C:\\Users\\corey\\AppData\\Local\\Temp\\pkg-5rf78R\\83edb02c6645e04d0ee9dfa46286f532453fe17d206b1f4a05f8c59b6220c86e' [Server] } ( at process.<anonymous> (C:\snapshot\audiobookshelf\server\Server.js)) [Server] node:internal/fs/utils:347 [Server] throw err; [Server] ^ [Server] Error: ENOENT: no such file or directory, open 'C:\Users\corey\AppData\Local\Temp\pkg-5rf78R\83edb02c6645e04d0ee9dfa46286f532453fe17d206b1f4a05f8c59b6220c86e' [Server] at Object.openSync (node:fs:599:3) [Server] at Object.openSync (pkg/prelude/bootstrap.js:793:32) [Server] at uncompressExternallyAndOpen (pkg/prelude/bootstrap.js:748:19) [Server] at pkg/prelude/bootstrap.js:763:32 [Server] at FSReqCallback.oncomplete (node:fs:201:23) { [Server] errno: -4058, [Server] syscall: 'open', [Server] code: 'ENOENT', [Server] path: 'C:\\Users\\corey\\AppData\\Local\\Temp\\pkg-5rf78R\\83edb02c6645e04d0ee9dfa46286f532453fe17d206b1f4a05f8c59b6220c86e' [Server] }

Please let me know if you need anything else. It has not happened again at this point.