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

GET jsonrpc/rate causes hard crash on r2298 w/musl #621

Closed
frebib opened this issue Mar 9, 2019 · 8 comments

Comments

Projects
None yet
2 participants
@frebib
Copy link
Contributor

commented Mar 9, 2019

Version testing-r2298, built as such: https://github.com/spritsail/nzbget/blob/4be292ac708e8cee44a146284ef2a3f20949f09d/Dockerfile#L9-L44

To reproduce:
curl -u 'user:pass' -v 'http(s)://hostname:port/jsonrpc/rate

Nothing appears in the logs. I presume it segfaults(?) before being able to write anything.
Only log output:

[INFO] nzbget 21.0-testing-r2298 server-mode
@frebib

This comment has been minimized.

Copy link
Contributor Author

commented Mar 9, 2019

I'm going to try building with --enable-debug to see if I can work out what is causing the crash

@frebib

This comment has been minimized.

Copy link
Contributor Author

commented Mar 9, 2019

Looks like musl is interfering/different (again 😢)

Core was generated by `nzbget -c /config/nzbget.conf -s -o OutputMode=log'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fc84a5fb9e4 in strchrnul () from /lib/ld-musl-x86_64.so.1
[Current thread is 1 (LWP 19)]
(gdb) bt
#0  0x00007fc84a5fb9e4 in strchrnul () from /lib/ld-musl-x86_64.so.1
#1  0x0000000000000022 in ?? ()
#2  0x00007fc84a5fb98e in strchr () from /lib/ld-musl-x86_64.so.1
#3  0x000055ee7a524008 in ?? ()
#4  0x00007fc84a5fc1a8 in strstr () from /lib/ld-musl-x86_64.so.1
#5  0x00007fc849f493a0 in ?? ()
#6  0x000055ee7a4db367 in XmlRpcProcessor::BuildErrorResponse(int, char const*) ()
#7  0x000055ee7a4e1aa4 in XmlRpcProcessor::Dispatch() ()
#8  0x000055ee7a4d66ba in WebProcessor::Dispatch() ()
#9  0x000055ee7a4d3917 in RequestProcessor::ServWebRequest(char const*) ()
#10 0x000055ee7a4d3b60 in RequestProcessor::Execute() ()
#11 0x000055ee7a4d3c59 in RequestProcessor::Run() ()
#12 0x000055ee7a4ec68d in ?? ()
#13 0x00007fc84a0d7800 in ?? () from /usr/lib/libstdc++.so.6
#14 0x00007fc84a5fe4d8 in ?? () from /lib/ld-musl-x86_64.so.1
#15 0x0000000000000000 in ?? ()

strchrnul source: https://git.musl-libc.org/cgit/musl/tree/src/string/strchrnul.c

I'm slowly working how gdb debugging works. I might try this again without optimisations:

(gdb) bt full
#0  __strchrnul (s=<optimized out>, c=c@entry=34) at src/string/strchrnul.c:21
        w = 0x0
        k = 2459565876494606882
#1  0x00007f498b2d898e in strchr (s=<optimized out>, c=34) at src/string/strchr.c:7
        r = <optimized out>
#2  0x00007f498b2d91a8 in strstr (h=<optimized out>, n=0x555cc3ac5008 "\"params\"") at src/string/strstr.c:145
No locals.
#3  0x0000555cc3a7c367 in XmlRpcProcessor::BuildErrorResponse(int, char const*) ()
No symbol table info available.
#4  0x0000555cc3a82aa4 in XmlRpcProcessor::Dispatch() ()
No symbol table info available.
#5  0x0000555cc3a776ba in WebProcessor::Dispatch() ()
@frebib

This comment has been minimized.

Copy link
Contributor Author

commented Mar 9, 2019

Crash doesn't occur with -O0 -g but does with -Ofast

@frebib frebib changed the title GET jsonrpc/rate causes hard crash on r2298 GET jsonrpc/rate causes hard crash on r2298 w/musl Mar 9, 2019

@frebib

This comment has been minimized.

Copy link
Contributor Author

commented Mar 9, 2019

I finally worked out how to get a backtrace without the symbol table being stripped (turns out -Wl,-s tells the linker to strip symbols. derp)

https://gist.githubusercontent.com/frebib/6a4e811e00a501e72756ebebbb42c541/raw/bc0d8fc877d85dee3cfc2697635ea73a761ced94/nzbget.core

@frebib

This comment has been minimized.

Copy link
Contributor Author

commented Mar 9, 2019

I think the problematic line is here:

processor.SetRequest(m_request);

Something to do with a pointer that the optimisations don't play nicely with

hugbug added a commit that referenced this issue Mar 10, 2019

@hugbug

This comment has been minimized.

Copy link
Member

commented Mar 10, 2019

This should be fixed now. Please test with current develop version.

@hugbug hugbug added the bug label Mar 10, 2019

@hugbug hugbug added this to the v21 milestone Mar 10, 2019

@frebib

This comment has been minimized.

Copy link
Contributor Author

commented Mar 10, 2019

Yep, that most certainly fixed it! Thanks very much :)

@frebib frebib closed this Mar 10, 2019

@hugbug

This comment has been minimized.

Copy link
Member

commented Mar 10, 2019

Thank you for reporting this and for all the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.