Core dump file is unavailable
- A brief description Core dump file is not exported.
- Expected results Core dump file is located on the current(+writable) directory. (based on general UNIX behavior)
- Actual results (with terminal output if applicable) No file
- Your Windows build number Build 14951 (Ubuntu 16.04)
- Steps / All commands required to reproduce the error from a brand new installation
ulimit -c unlimited
echo "main(){raise(11);}" > test.c; gcc -g -o test.o test.c; strace ./test.o
- Strace of the failing command (without some GCC warnings)
execve("./test.o", ["./test.o"], [/* 16 vars */]) = 0
brk(NULL) = 0x14c9000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6ec8e70000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=24473, ...}) = 0
mmap(NULL, 24473, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f6ec8e6a000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1864888, ...}) = 0
mmap(NULL, 3967488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f6ec8830000
mprotect(0x7f6ec89f0000, 2093056, PROT_NONE) = 0
mmap(0x7f6ec8bef000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bf000) = 0x7f6ec8bef000
mmap(0x7f6ec8bf5000, 14848, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f6ec8bf5000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6ec8e60000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6ec8e50000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6ec8e40000
arch_prctl(ARCH_SET_FS, 0x7f6ec8e50700) = 0
mprotect(0x7f6ec8bef000, 16384, PROT_READ) = 0
mprotect(0x600000, 4096, PROT_READ) = 0
mprotect(0x7f6ec8e25000, 4096, PROT_READ) = 0
munmap(0x7f6ec8e6a000, 24473) = 0
gettid() = 4601
tgkill(4601, 4601, SIGSEGV) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SI_TKILL, si_pid=4601, si_uid=1000} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)
- Required packages and commands to install
- build-essential
This is a known issue that we are aware of, it is something we are investigating.
how is the progress? can I debug on windows bash?
ping -- I just hit this; it's still an issue on build 15046. (I imagine that's not too surprising, but, keeping it on peoples' radar.)
Any news on this or any progress?
User voice is here since it wasn't mentioned above.
It's still an issue today, even after updating to Ubuntu 18.04..
@terrywh I've just tried the vote button again this morning and it seems to work fine here (Chrome 66 on Win 7)
thanks, it seems something is wrong with my network(failed to load js file on that page), after using a proxy everything works fine. @wolf99
it's been a while, and I'm running into this on build 18262... have there been any updates?
As mentioned in https://github.com/Microsoft/WSL/issues/3657#issuecomment-437678770 there seems to be a general issue with the default signal handler(s) not operating as expected in WSL.
In my case it becomes a blocker while debugging scientific/numerical software. Typically, I enable trapping of floating-point exceptions like divide-by-zero, overflow, invalid (domain error). Then, running the software under gdb, it would normally stop at the SIGFPE signal whenever any of such conditions occurs and I can inspect the backtrace, local variables etc. and ultimately fix bugs a lot easier. In WSL, the program just exits in those cases without gdb stopping, making debugging significantly harder to the point where I have to switch to native Linux.
What's missing to get this working as it should?
Echoing the sentiments stated by everyone here; this bug makes developing C++ programs very difficult. Are there any work-arounds for the time being?
Only that: don't want core dumps. Or don't use WSL but go back and don't use Windows to develop then (ssh remote development or VM or Linux on desktop). Nothing else that comes into my mind just yet.
Please implement that!
Under the fast ring feature WSL2 (Ubuntu 18.04.3 LTS), the core dump file appeared. (see Installation Instructions for WSL 2) However, it appeared as an empty file in the working folder. Fortunately, the post on stackoverflow comes to rescue. (see Empty core dump file after Segmentation fault)
Use sysctl to set /proc/sys/kernel/core_pattern=/tmp/core
sudo sysctl -w kernel.core_pattern=/tmp/core
(see Why is editing core_pattern restricted?)
Now, the command gdb with core dump file works as expected.
gdb ./testCoreDump /tmp/core
I think it is the best workaround I can find now.
Any updates for this issue? Or even any way to workaround?
Under the fast ring feature WSL2 (Ubuntu 18.04.3 LTS), the core dump file appeared. (see Installation Instructions for WSL 2) However, it appeared as an empty file in the working folder. Fortunately, the post on stackoverflow comes to rescue. (see Empty core dump file after Segmentation fault)
Use sysctl to set /proc/sys/kernel/core_pattern=/tmp/core
sudo sysctl -w kernel.core_pattern=/tmp/core(see Why is editing core_pattern restricted?)Now, the command gdb with core dump file works as expected.
gdb ./testCoreDump /tmp/coreI think it is the best workaround I can find now.
it works for me! you saved my day! thank you very much!
~Doesn't work for me:~
/mnt/c $ sudo sysctl kernel.core_pattern
sysctl: cannot stat /proc/sys/kernel/core_pattern: No such file or directory
/mnt/c $ sudo sysctl -w kernel.core_pattern=/tmp/core
sysctl: cannot stat /proc/sys/kernel/core_pattern: No such file or directory
~Using WSL2. Any ideas?~
Edit: sorry I was wrong, my distro was still using WSL1. I updated to the new windows insider build and used instructions on https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel.
@therealkenc "fixed in WSL2" isn't a great resolution for the many of us left on WSL 1 for the foreseeable. In fact its a pretty poor response given that WSL2 isn't even available to the vast majority of normal Windows users yet (never mind those held back to pre-1909 versions of Window due to, eg, corporate update policies)
@wolf99 I do agree with you, however the reality is that MS has limited resources (as do we all), and they've been shifting most of their WSL dev time to WSL2.
I'd be happy to be wrong, but reading between the lines leads me to believe that most issues such as this one which are working correctly in WSL2 won't be addressed in WSL1 anytime in the foreseeable future, if at all.
@gurnec Thanks for the link I'd admit that if 2004 had rolled out fully or even to the majority of users, then that would be at least logical. But in reality 2004 is only in the early stages of what promises to be a pretty long roll-out.
My machine only received 1909 about March (4 months after initial "release"), if 2004 follows a similar trend I won't see 2004 until September at least. To simply abandon the majority of users seems harebrained at best.
What seems to be happening morso is development aimed at people on faster rings. While I can see those rings provide good feedback, developing solely with those foremost in mind is probably part of the issue for these troubled OS roll-outs.