Open abraunegg opened 4 years ago
One major difference between the official builds and the Ubuntu ones (not managed by us directly) is that Ubuntu links against the shared druntime and Phobos libs (and the official builds against the static ones by default). Please try adding -link-defaultlib-shared
to the cmdline when using the official package; if that produces the segfault too, it's not the Ubuntu packaging.
Thanks for the suggestion - some testing below:
Using Ubuntu LDC Package (installed via 'sudo apt install ldc'):
--link-defaultlib-shared
is added .. but I am guessing this is to be expectedUsing LDC Install via curl -fsS https://dlang.org/install.sh | bash -s ldc-1.20.1
--link-defaultlib-shared
is added - segfault exists--link-defaultlib-shared
is removed - segfault no longer occursAs expected, it occurs with the shared libs only, and the Ubuntu packager is not to blame. It might be a problem in your codebase (possibly during teardown in a class finalizer which is indeterministic AFAIK); a stack trace would at least shed a bit more light on this. You can also test the shared debug libs with -link-defaultlib-shared -link-defaultlib-debug
(e.g., for better stack traces).
@kinke
In adding --link-defaultlib-shared --link-defaultlib-debug
, then running strace <app>
then attempting to get the segfault - nothing obvious is popping up (debug vs no debug & breaking at the same point)
Without strace:
The file has not changed
Processing Lightburn
The directory has not changed
Processing Lightburn/t.txt
The file has not changed
Processing newfile.txt
The file has not changed
Uploading new items of ~/OneDrive
Skipping item - excluded by skip_dir config: ./random_images
Skipping item - excluded by skip_dir config: ./random_files
Applying changes of Path ID: 01WIXGO5V6Y2GOVW7725BZO354PWSELRRZ
Updated Remaining Free Space: 1088478209988
Sync with OneDrive is complete
^CGot termination signal, shutting down db connection
Segmentation fault (core dumped)
With strace:
read(7, "\27\3\3\31\37", 5) = 5
read(7, "\0\0\0\0\0\0\0\26\3211\6f\16:4\245uJ0m%&\302\32!\302qZ]\300R;"..., 6431) = 6431
poll([{fd=4, events=POLLIN}], 1, 0) = 0 (Timeout)
write(7, "\27\3\3\n\211\335\2\200v\3309\237\237f\324\263\307\ns\336\325\2\246Sl\304St\v\224\355\4"..., 2702) = 2702
poll([{fd=7, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=7, events=POLLIN}, {fd=4, events=POLLIN}], 2, 1000) = 1 ([{fd=7, revents=POLLIN}])
poll([{fd=7, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 1 ([{fd=7, revents=POLLIN|POLLRDNORM}])
read(7, "\27\3\3\48", 5) = 5
read(7, "\0\0\0\0\0\0\0\27\7\31Mr\310C\1\325\350P\\\211\276\375}.\36\26.\233x\373\303~"..., 1080) = 1080
fcntl(9, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=124, l_len=1}) = 0
fcntl(9, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=120, l_len=1}) = 0
pwrite64(8, "\0\0\0\3\0\0\0\0a7\347\217\350kc\201\204\337u\341\244\252\376a", 24, 774592) = 24
pwrite64(8, "\n\0\0\0\34\4M\0\f\251\10{\7\245\tQ\16U\r\177\r\24\r\352\5\216\6\317\6d\16\300"..., 4096, 774616) = 4096
pwrite64(8, "\0\0\0\4\0\0\0\0a7\347\217\350kc\201\10}\347|\250P\277:", 24, 778712) = 24
pwrite64(8, "\n\0\0\0\34\16)\0\16C\17\307\17\242\17\223\16\330\17f\16\253\17\204\16\311\17*\16o\17u"..., 4096, 778736) = 4096
pwrite64(8, "\0\0\0\5\0\0\0\0a7\347\217\350kc\201\341~\177\226\274\263i\270", 24, 782832) = 24
pwrite64(8, "\n\0\0\0\34\17Y\0\17\373\17\365\17\357\17\351\17\343\17\335\17\327\17\321\17\313\17\305\17\277\17\271"..., 4096, 782856) = 4096
pwrite64(8, "\0\0\0\6\0\0\0\0a7\347\217\350kc\201\345\262'n\tu\367\233", 24, 786952) = 24
pwrite64(8, "\n\0\0\0\34\4o\0\17\270\16\f\r\241\r6\f\313\f`\v\365\v\212\v\37\n\264\nI\16w"..., 4096, 786976) = 4096
pwrite64(8, "\0\0\0\7\0\0\0\0a7\347\217\350kc\201\314\26A\32n\310V8", 24, 791072) = 24
pwrite64(8, "\n\0\0\0\34\3\4\0\3\354\16\263\16&\r\260\10\207\fN\7%\r:\10\21\nv\5M\f\304"..., 4096, 791096) = 4096
pwrite64(8, "\0\0\0\10\0\0\0\na7\347\217\350kc\201\337\265\321\0\212j5\201", 24, 795192) = 24
pwrite64(8, "\r\17l\0\n\2\314\0\2\314\16W\r5\f\r\n\336\t\257\10\200\7Q\6\"\4\363\2\225\1f"..., 4096, 795216) = 4096
fdatasync(8) = 0
fcntl(9, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=120, l_len=1}) = 0
fcntl(9, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=124, l_len=1}) = 0
poll([{fd=10, events=POLLIN}], 1, 0) = 0 (Timeout)
write(1, "Sync with OneDrive is complete", 30Sync with OneDrive is complete) = 30
write(1, "\n", 1
) = 1
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=500000000}, 0x7ffe71845f68) = 0
poll([{fd=10, events=POLLIN}], 1, 0) = 0 (Timeout)
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=500000000}, 0x7ffe71845f68) = 0
poll([{fd=10, events=POLLIN}], 1, 0) = 0 (Timeout)
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=500000000}, 0x7ffe71845f68) = 0
poll([{fd=10, events=POLLIN}], 1, 0) = 0 (Timeout)
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=500000000}, 0x7ffe71845f68) = 0
poll([{fd=10, events=POLLIN}], 1, 0) = 0 (Timeout)
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=500000000}, 0x7ffe71845f68) = 0
poll([{fd=10, events=POLLIN}], 1, 0) = 0 (Timeout)
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=500000000}, 0x7ffe71845f68) = 0
poll([{fd=10, events=POLLIN}], 1, 0) = 0 (Timeout)
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=500000000}, 0x7ffe71845f68) = 0
poll([{fd=10, events=POLLIN}], 1, 0) = 0 (Timeout)
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=500000000}, 0x7ffe71845f68) = 0
poll([{fd=10, events=POLLIN}], 1, 0) = 0 (Timeout)
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=500000000}, 0x7ffe71845f68) = 0
poll([{fd=10, events=POLLIN}], 1, 0) = 0 (Timeout)
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=500000000}, 0x7ffe71845f68) = 0
poll([{fd=10, events=POLLIN}], 1, 0) = 0 (Timeout)
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=500000000}, 0x7ffe71845f68) = 0
poll([{fd=10, events=POLLIN}], 1, 0) = 0 (Timeout)
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=500000000}, 0x7ffe71845f68) = 0
poll([{fd=10, events=POLLIN}], 1, 0) = 0 (Timeout)
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=500000000}, ^C{tv_sec=0, tv_nsec=186239653}) = ? ERESTART_RESTARTBLOCK (Interrupted by signal)
strace: Process 8405 detached
(ldc-1.20.1)alex@ubuntu-20-04-LTS:~/code/onedrive$ Got termination signal, shutting down db connection
(ldc-1.20.1)alex@ubuntu-20-04-LTS:~/code/onedrive$
If the issue is only with using the shared libraries, is there an LDC option that can be passed in to overwrite the Ubuntu default behavior?
If the issue is only with using the shared libraries, is there an LDC option that can be passed in to overwrite the Ubuntu default behavior?
Well, software is supposed to work with both. You could resort to -link-defaultlib-shared=false
, but that might require additional Ubuntu packages.
Segmentation fault (core dumped)
The core file should contain all required infos to reconstruct the backtrace with gdb.
Hi all,
I am the maintainer of the Linux OneDrive client (https://github.com/abraunegg/onedrive) that utilises DMD or LDC as the compiler. Under Ubuntu however, when using the the LDC Ubuntu package, the resulting binary segfaults. The LDC package that Ubuntu installs is LDC 1.20.1.
When not using the Ubuntu LDC package, but installing LDC manually (
curl -fsS https://dlang.org/install.sh | bash -s ldc
) no such segfault in the application occurs - even when installing the same version that the Ubuntu LDC package installs.Please can someone from the LDC team look into why the LDC Ubuntu package is causing resulting binary files to segfault?
References: