masm11 / emacs

Mirror of GNU Emacs
http://www.gnu.org/software/emacs/
GNU General Public License v3.0
198 stars 14 forks source link

Random Core dump with drag and drop #66

Closed A6GibKm closed 3 years ago

A6GibKm commented 3 years ago

When dragging files into emacs, there is a random chance that a crash will happen.

This happens very often when writing mail and using drag and drop to include an attachment.

Screencast: Drag-n-drop-core-dump.zip

Backtrace:


$ emacs -Q
Fatal error 6: Aborted
Backtrace:
emacs[0x50135d]
emacs[0x420198]
emacs[0x420abc]
emacs[0x428216]
emacs[0x435313]
emacs[0x4ef082]
emacs[0x4fabc8]
emacs[0x4ef91e]
emacs[0x56b547]
emacs[0x4e9c84]
emacs[0x56b4a1]
emacs[0x4eaf0b]
emacs[0x635bfb]
emacs[0x4ef663]
emacs[0x429b19]
/lib64/libc.so.6(__libc_start_main+0xf2)[0x7fa4a921a1a2]
emacs[0x42bd2e]
Aborted (core dumped

Environment

GNOME 3.38 & Wayland

Steps to reproduce

Create an empty file touch empty open in terminal emacs -Q drag and drop the file Empty onto emcas until a crash happens, see screencast

Note: This appears to happen at random, sometimes it will not happen, sometimes it happens on the second or third time the file is dragged. It might be a memory safety issue?

Edit: Added screencast.

masm11 commented 3 years ago

It does not reproduce... I dragand dropped a empty file about 60 times.

I'll try again later.

A6GibKm commented 3 years ago

I had to close emacs many times, sometimes it happens, sometimes it does not

masm11 commented 3 years ago

it doesn't reproduce on wayfire, but reproduced on GNOME(Wayland).

A6GibKm commented 3 years ago

I tried reproducing this on a non-pgtk build and it simply does not happen.

masm11 commented 3 years ago

It crashes here: https://github.com/masm11/emacs/blob/2d5e81ce9487217f87c954af0c501a9515b67413/src/process.c#L5689 because of watching closed file descriptor, which might be previously used for communication with nautilus.

I'll dive deeper.

A6GibKm commented 3 years ago

Thats not part of the pgtk codebase right? Have in mind that this was not reproducible without pgtk? In any case, this is beyond me

masm11 commented 3 years ago

Watching file descriptors is in pgtk code. It crashes because of an error which is returned from that code.

I'll dive deeper to find the underlying bug, which may be in pgtk code, gtk, or nautilus.

masm11 commented 3 years ago

Try #67.

A6GibKm commented 3 years ago

Thanks! It was very troublesome to be writing an email and getting that coredump while attaching a file. Fixed by #67, I tried for some good 5 minutes to reproduce it and it did not happen once, while before it was relatively often.

But at least one time I got a crash with error message

Gdk-Message: 13:41:24.008: Error reading events from display: Invalid argument

I was not able to reproduce it though. I am going to leave this open until you merge the PR or comment on the Gdk error.

masm11 commented 3 years ago

I have not idea about why the gdk message is emitted. I don't think it has anything to do with the PR. Please write a issue if it is reproduced.

I'll merge the PR.

A6GibKm commented 3 years ago

Ok, will do if I ever encounter it again, if it is actually a thing, it might be an issue elsewhere.