Bug 164395 - Web process crashed when receiving sighup signal
Summary: Web process crashed when receiving sighup signal
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: PC Linux
: P2 Critical
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-03 19:15 PDT by antoyo
Modified: 2016-11-04 10:00 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description antoyo 2016-11-03 19:15:59 PDT
Hello.
I found that WebKit2 (not sure if it is WebKit2Gtk but I use it) crashes when receiving a sighup signal.
This even affects Epiphany where the application completely crashes, hence the Critical severity.

I don't know a simple way to reproduce the bug, so I post the way I can always reproduce the issue:

1. Configure the newsbeuter RSS client to use epiphany (put `browser "epiphany %u &"` in `~/.config/newsbeuter/config) and at a least a feed URL in `~/.config/newsbeuter/urls`.
2. Run the command `urxvt -e newsbeuter` from the terminal.
3. Open a feed (with Enter), then a link (with O — capital o): this will open epiphany.
4. Exit newsbeuter (by hitting twice q): this will make epiphany crash.

Note that I do not get this issue if I run the command `newsbeuter` instead of `urxvt -e newsbeuter`.
This issue does not happen in other web browsers.

While debugging the web process with gdb, I see the following:

[Thread 0x7fde77556700 (LWP 9825) exited]

Thread 1 "WebKitWebProces" received signal SIGHUP, Hangup.
0x00007fdedc34c48d in poll () from /usr/lib/libc.so.6
(gdb) cont
Continuing.
Couldn't get registers: Aucun processus de ce type.
Couldn't get registers: Aucun processus de ce type.
Couldn't get registers: Aucun processus de ce type.
(gdb) [Thread 0x7fde5d12e700 (LWP 9842) exited]
[Thread 0x7fde5fdf2700 (LWP 9829) exited]
[Thread 0x7fde74dff700 (LWP 9828) exited]
[Thread 0x7fde76d55700 (LWP 9827) exited]
[Thread 0x7fdec4b11700 (LWP 9824) exited]
[Thread 0x7fdec5312700 (LWP 9823) exited]
[Thread 0x7fdec6314700 (LWP 9818) exited]
[Thread 0x7fdec6b15700 (LWP 9817) exited]
[Thread 0x7fdec8bfc700 (LWP 9816) exited]
[Thread 0x7fdedf0159c0 (LWP 9805) exited]

At first, I thought it has something to do with gdbus (because I sometimes saw the message "Thread gdbus exited" or something similar), but the MiniBrowser also has this issue and I don't think it uses gdbus.

If you are unable to reproduce this issue or want more information, feel free to ask.

I run ArchLinux with
epiphany 3.22.1
webkit2gtk 2.14.2

Thanks to fix this issue.
Comment 1 Michael Catanzaro 2016-11-03 20:52:44 PDT
I guess there are two likely possibilities here:

 * urxvt is probably the controlling process of the session that WebKit is running in, so when it dies the kernel is going to send SIGHUP to all processes in the foreground process group of its controlling terminal.

 * Alternatively, maybe more likely urxvt's death could have caused the process group of the WebKitWebProcess to become orphaned; that will trigger a SIGHUP.

Either way, it wouldn't be a WebKit bug. I'm going to close this because I really doubt there is a WebKit bug here. For a better understanding of terminal job control, you might want to investigate chapter 34 of "The Linux Programming Interface".

The only part I don't understand is why the UI process does not die too!
Comment 2 antoyo 2016-11-04 05:29:12 PDT
I think that your last sentence (and the fact that this issue does not happen with other browsers) is a proof that there is a bug in WebKit2.
Comment 3 Michael Catanzaro 2016-11-04 06:21:11 PDT
It's really not. You are killing the controlling process of the session WebKit is running in, why would you expect it to keep running?
Comment 4 antoyo 2016-11-04 06:45:06 PDT
Because it does not happen with other (non-webkit2 based) browsers, so I believe the process is detached in some way.
Moreover, the same issue happens when I use "nohup epiphany" which detaches the process.
My web browser based on webkit2 is not killed: only the web process is killed (I receive the "web-process-crashed" event).
How do you explain that if the whole process was killed?
Comment 5 Michael Catanzaro 2016-11-04 08:28:51 PDT
(In reply to comment #4)
> Because it does not happen with other (non-webkit2 based) browsers, so I
> believe the process is detached in some way.

Yes, all child processes are intentionally reparented to init so that the UI process doesn't have to reap them.

> Moreover, the same issue happens when I use "nohup epiphany" which detaches
> the process.

That's not going to do any good for the child processes.

> My web browser based on webkit2 is not killed: only the web process is
> killed (I receive the "web-process-crashed" event).
> How do you explain that if the whole process was killed?

I don't understand the question; it's clear that only the web processes are being killed....
Comment 6 antoyo 2016-11-04 09:01:05 PDT
Oh, I think I understand now.
Do you mean that since the web process is started by `newsbeuter`, it will be killed when `newsbeuter` leaves?

I still think there is a bug in Epiphany thought (because the UI should not crash when the web process is crashed).

Do you know a workaround for this issue?
I open the web browser from many console application so how can I launch a webkit2-based web browser from a console application without killing its web process when the console application exits?

Thanks for your answer.
Comment 7 Carlos Alberto Lopez Perez 2016-11-04 09:44:42 PDT
For the record, I have checked that Chromium behaves the same way:

1. Open xterm
2. Open chromium in background:
$ chromium &
3. Close xterm.

Result: Chromium dies.
Comment 8 Carlos Alberto Lopez Perez 2016-11-04 09:48:24 PDT
(In reply to comment #6)
> Oh, I think I understand now.
> Do you mean that since the web process is started by `newsbeuter`, it will
> be killed when `newsbeuter` leaves?
> 
> I still think there is a bug in Epiphany thought (because the UI should not
> crash when the web process is crashed).
> 
> Do you know a workaround for this issue?
> I open the web browser from many console application so how can I launch a
> webkit2-based web browser from a console application without killing its web
> process when the console application exits?
> 
> Thanks for your answer.

Use something like this: https://documentation.codeship.com/continuous-integration/run-a-command-in-the-background/

This works:

nohup bash -c "epiphany 2>&1 &"
Comment 9 Michael Catanzaro 2016-11-04 10:00:38 PDT
(In reply to comment #6)
> I still think there is a bug in Epiphany thought (because the UI should not
> crash when the web process is crashed).

Yes, a web process crash should never kill the UI process. I didn't realize the UI process was crashing too. Are you sure it's not also receiving SIGHUP? Can you post a backtrace?