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

Carbon segfault with 1.9 #187

Closed
prymitive opened this issue Mar 20, 2013 · 1 comment
Closed

Carbon segfault with 1.9 #187

prymitive opened this issue Mar 20, 2013 · 1 comment

Comments

@prymitive
Copy link
Contributor

Am I doing something wrong? Fresh checkout on 2 different machines give me:

/u$ ./uwsgi --http :8080 --wsgi-file tests/staticfile.py --carbon xxx
*** Starting uWSGI 1.9 (64bit) on [Wed Mar 20 20:32:46 2013] ***
compiled with version: 4.6.3 on 20 March 2013 20:32:36
os: Linux-3.2.0-38-generic #61-Ubuntu SMP Tue Feb 19 12:18:21 UTC 2013
[...]
[carbon] added server xxx
[carbon] carbon plugin started, 60s frequency, 3s timeout, max retries 1, retry delay 7s
!!! uWSGI process 1124 got Segmentation Fault !!!
*** backtrace of 1124 ***
./uwsgi(uwsgi_backtrace+0x25) [0x451b95]
./uwsgi(uwsgi_segfault+0x21) [0x451c71]
/lib/x86_64-linux-gnu/libc.so.6(+0x364a0) [0x7f7982a804a0]
/lib/x86_64-linux-gnu/libc.so.6(+0x89101) [0x7f7982ad3101]
./uwsgi(uwsgi_concat2+0x23) [0x44cd83]
./uwsgi(uwsgi_stats_pusher_add+0xa2) [0x437342]
./uwsgi() [0x470715]
./uwsgi(uwsgi_start+0x43f) [0x452cbf]
./uwsgi(main+0x17aa) [0x41be2a]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f7982a6b76d]
./uwsgi() [0x41bea5]
*** end of backtrace ***

This is caused by uspi->arg = uwsgi_str(arg); on https://github.com/unbit/uwsgi/blob/master/core/stats.c#L386

since arg is passed as NULL, so uwsgi_str(NULL) fails in very ugly way.

This fixes it

diff --git a/core/stats.c b/core/stats.c
index 4cf5ebd..19ac3cf 100644
--- a/core/stats.c
+++ b/core/stats.c
@@ -383,7 +383,9 @@ struct uwsgi_stats_pusher_instance *uwsgi_stats_pusher_add(struct uwsgi_stats_pu

        uspi = uwsgi_calloc(sizeof(struct uwsgi_stats_pusher_instance));
        uspi->pusher = pusher;
-       uspi->arg = uwsgi_str(arg);
+       if (uspi->arg) {
+               uspi->arg = uwsgi_str(arg);
+       }
        uspi->raw = pusher->raw;
        if (old_uspi) {
                old_uspi->next = uspi;

But maybe real bug is elsewhere, maybe arg should be != NULL?
This happens with both 1.9 tag and current master.

@prymitive
Copy link
Contributor Author

fix was merged with #188, closing

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

1 participant