{"action":"created","issue":{"url":"https://api.github.com/repos/systemd/systemd/issues/835","labels_url":"https://api.github.com/repos/systemd/systemd/issues/835/labels{/name}","comments_url":"https://api.github.com/repos/systemd/systemd/issues/835/comments","events_url":"https://api.github.com/repos/systemd/systemd/issues/835/events","html_url":"https://github.com/systemd/systemd/issues/835","id":98623773,"number":835,"title":"terminal_vhangup() should open ttys with O_NONBLOCK, and then drop the bit immediately after","user":{"login":"rfjakob","id":286847,"avatar_url":"https://avatars.githubusercontent.com/u/286847?v=3","gravatar_id":"","url":"https://api.github.com/users/rfjakob","html_url":"https://github.com/rfjakob","followers_url":"https://api.github.com/users/rfjakob/followers","following_url":"https://api.github.com/users/rfjakob/following{/other_user}","gists_url":"https://api.github.com/users/rfjakob/gists{/gist_id}","starred_url":"https://api.github.com/users/rfjakob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rfjakob/subscriptions","organizations_url":"https://api.github.com/users/rfjakob/orgs","repos_url":"https://api.github.com/users/rfjakob/repos","events_url":"https://api.github.com/users/rfjakob/events{/privacy}","received_events_url":"https://api.github.com/users/rfjakob/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/systemd/systemd/labels/util-lib","name":"util-lib","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-08-02T17:31:46Z","updated_at":"2015-08-03T17:07:54Z","closed_at":null,"body":"I have an ARM-based embedded system here running Debian Jessie, that every now and then fails to shut down cleanly. systemd hangs trying to `open(\"/dev/ttyS2\", ...)`. `ttyS2` is a hardware serial that is the primary console of this system.\r\n\r\nFortunately the SSH sessions are still up at that point and I got an strace and gdb backtrace (see below).\r\n\r\nComparing the systemd code with picocom I noticed that picocom uses O_NONBLOCK whereas systemd does not ( https://code.google.com/p/picocom/source/browse/trunk/picocom.c#1174 ).\r\n\r\nStrace:\r\n\r\n\tstrace -p 1\r\n\tProcess 1 attached\r\n\topen(\"/dev/ttyS2\", O_RDWR|O_NOCTTY|O_LARGEFILE|O_CLOEXEC\r\n\r\nGDB backtrace:\r\n\r\n\t(gdb) attach 1\r\n\t(gdb) bt\r\n\t#0  0xb6f80534 in __libc_do_syscall () from /lib/arm-linux-gnueabihf/libpthread.so.0\r\n\t#1  0xb6f7eeb8 in open64 () from /lib/arm-linux-gnueabihf/libpthread.so.0\r\n\t#2  0x0003ab36 in __open_alias () at /usr/include/arm-linux-gnueabihf/bits/fcntl2.h:59\r\n\t#3  open_terminal (name=<optimized out>, mode=524546) at ../src/shared/util.c:1788\r\n\t#4  0x0009b68c in terminal_vhangup (name=<optimized out>) at ../src/shared/util.c:4099\r\n\t#5  exec_context_tty_reset.lto_priv.850 (context=context@entry=0x1e96f70) at ../src/core/execute.c:183\r\n\t#6  0x0009a2ca in exec_status_exit (s=s@entry=0x1e970e0, context=context@entry=0x1e96f70, pid=pid@entry=212, code=code@entry=2, status=status@entry=15)\r\n\t\tat ../src/core/execute.c:2393\r\n\t#7  0x000641cc in service_sigchld_event.lto_priv.385 (u=0x1e96d60, pid=212, code=2, status=15) at ../src/core/service.c:2186\r\n\t#8  0x00095474 in manager_dispatch_sigchld (m=0x1dc08e0) at ../src/core/manager.c:1639\r\n\t#9  0x00096e80 in manager_dispatch_signal_fd.lto_priv.950 (source=<optimized out>, fd=<optimized out>, revents=<optimized out>, userdata=0x1dc08e0) at ../src/core/manager.c:1890\r\n\t#10 0x0002a55c in source_dispatch (s=0x1dc0ea8) at ../src/libsystemd/sd-event/sd-event.c:2016\r\n\t#11 0x0002e0ca in sd_event_run (e=0x1dc0bb0, timeout=<optimized out>) at ../src/libsystemd/sd-event/sd-event.c:2314\r\n\t#12 0x000966b2 in manager_loop (m=0x1dc08e0) at ../src/core/manager.c:2009\r\n\t#13 0x00018e6c in main (argc=0, argv=0x7) at ../src/core/main.c:1743"},"comment":{"url":"https://api.github.com/repos/systemd/systemd/issues/comments/127333192","html_url":"https://github.com/systemd/systemd/issues/835#issuecomment-127333192","issue_url":"https://api.github.com/repos/systemd/systemd/issues/835","id":127333192,"user":{"login":"poettering","id":2130732,"avatar_url":"https://avatars.githubusercontent.com/u/2130732?v=3","gravatar_id":"","url":"https://api.github.com/users/poettering","html_url":"https://github.com/poettering","followers_url":"https://api.github.com/users/poettering/followers","following_url":"https://api.github.com/users/poettering/following{/other_user}","gists_url":"https://api.github.com/users/poettering/gists{/gist_id}","starred_url":"https://api.github.com/users/poettering/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poettering/subscriptions","organizations_url":"https://api.github.com/users/poettering/orgs","repos_url":"https://api.github.com/users/poettering/repos","events_url":"https://api.github.com/users/poettering/events{/privacy}","received_events_url":"https://api.github.com/users/poettering/received_events","type":"User","site_admin":false},"created_at":"2015-08-03T17:07:54Z","updated_at":"2015-08-03T17:07:54Z","body":"There's a fix for this in PR #865. Please have a look."}}