3

I have a number of files open in my editor (geany). I managed to hang it doing a sort on a large list that I should have saved and just sent through a pipe to sort via command-line (I mapped one of the custom commands to sort, so Ctrl+1 will sort the current selection). If I attach strace to this process as suggested in this answer, I see the following:

write(18, "000011317XYZ01\n000011317XYZ01\n00"..., 8325030

the stuff in the quotes is what I was sorting. I may or may not have left unsaved changes open in other files. I'm fairly certain anything left is unimportant, but on the off chance I forgot to save some work, I'd like to kill this write and free the program to resume functioning. Is this possible, and if so, how can I do it?

EDIT: lsof output:

COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF      NODE NAME
geany   17502   me  cwd    DIR               0,32     4096      2799 /mnt/aleph/edit/timothy/aleph_stats/acq_firm
geany   17502   me  rtd    DIR               8,10     4096         2 /
geany   17502   me  txt    REG                8,8  2354896   1049732 /usr/bin/geany
geany   17502   me  mem    REG                8,8 88585928    542673 /usr/share/icons/gnome/icon-theme.cache
geany   17502   me  mem    REG                8,8 38535164    557602 /usr/share/icons/hicolor/icon-theme.cache
geany   17502   me  mem    REG                8,8 23512808    834745 /usr/lib64/libicudata.so.52.1
geany   17502   me  DEL    REG                8,8             542688 /usr/share/icons/gnome/icon-theme.cache
geany   17502   me  DEL    REG                8,8             553973 /usr/share/icons/hicolor/icon-theme.cache
geany   17502   me  mem    REG                8,8   611556    568798 /usr/share/fonts/dejavu/DejaVuSans-Oblique.ttf
geany   17502   me  mem    REG                8,8   672300    568795 /usr/share/fonts/dejavu/DejaVuSans-Bold.ttf
geany   17502   me  DEL    REG                0,4          184483854 /SYSV00000000
geany   17502   me  DEL    REG                8,8            1188828 /usr/lib64/gconv/ISO8859-1.so
geany   17502   me  DEL    REG                0,4          184385538 /SYSV00000000
geany   17502   me  mem    REG                8,8  1522200    834750 /usr/lib64/libicuuc.so.52.1
geany   17502   me  mem    REG                8,8  1450760    788304 /usr/lib64/libxml2.so.2.9.1
geany   17502   me  mem    REG                8,8    26784   1188919 /usr/lib64/geany/pretty-printer.so
geany   17502   me  mem    REG                8,8    39344   1188915 /usr/lib64/geany/htmlchars.so
geany   17502   me  mem    REG                8,8    47624    802077 /usr/lib64/libenchant.so.1.6.0
geany   17502   me  mem    REG                8,8    27240    802366 /usr/lib64/libgtkspell.so.0.0.0
geany   17502   me  DEL    REG                8,8             624545 /usr/share/icons/hicolor/icon-theme.cache
geany   17502   me  mem    REG                8,8   313856    568804 /usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf
geany   17502   me  mem    REG                8,8    84984   1188912 /usr/lib64/geany/geanyvc.so
geany   17502   me  mem    REG                8,8    99632   1188896 /usr/lib64/geany/geanylatex.so
geany   17502   me  mem    REG               8,10   349816    672871 /lib64/libncurses.so.5.9
geany   17502   me  mem    REG                8,8   652992    803024 /usr/lib64/libvte.so.9.2800.2
geany   17502   me  mem    REG                8,8    23000   1184701 /usr/lib64/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so
geany   17502   me  DEL    REG               8,10             653148 /lib64/libnss_files-2.16.so
geany   17502   me  DEL    REG               8,10             653144 /lib64/libnss_nis-2.16.so
geany   17502   me  DEL    REG               8,10             653150 /lib64/libnsl-2.16.so
geany   17502   me  DEL    REG               8,10             653135 /lib64/libnss_compat-2.16.so
geany   17502   me  mem    REG                8,8    48192   1189447 /usr/lib64/gio/modules/libdconfsettings.so
geany   17502   me  DEL    REG                8,8            1202522 /usr/lib64/gio/modules/libgioremote-volume-monitor.so#new
geany   17502   me  mem    REG                8,8   341088    801633 /usr/lib64/libibus-1.0.so.5.0.502
geany   17502   me  mem    REG                8,8   249424    796649 /usr/lib64/libdbus-1.so.3.7.6
geany   17502   me  mem    REG                8,8   241972    568806 /usr/share/fonts/dejavu/DejaVuSansMono-Oblique.ttf
geany   17502   me  mem    REG                8,8    31600   1185042 /usr/lib64/gtk-2.0/2.10.0/immodules/im-ibus.so
geany   17502   me  mem    REG                8,8   720012    568799 /usr/share/fonts/dejavu/DejaVuSans.ttf
geany   17502   me  mem    REG                8,8    14632    272931 /usr/lib64/pango/1.8.0/modules/pango-basic-fc.so
geany   17502   me  mem    REG                8,5   210920    528159 /var/cache/fontconfig/6b6a5d05491ac801f42cf67ebd0a6108-le64.cache-4
geany   17502   me  mem    REG                8,5    10264    529015 /var/cache/fontconfig/0b1bcc92b4d25cc154d77dafe3bceaa0-le64.cache-4
geany   17502   me  mem    REG                8,5    41640    529013 /var/cache/fontconfig/acc285bc1956c3c4bc7afb41d537a85a-le64.cache-4
geany   17502   me  mem    REG                8,5    23600    529011 /var/cache/fontconfig/4467b976098fb13588b23c76ba4750d8-le64.cache-4
geany   17502   me  mem    REG                8,5    98832    529010 /var/cache/fontconfig/8d4af663993b81a124ee82e610bb31f9-le64.cache-4
geany   17502   me  mem    REG                8,5    55328    529008 /var/cache/fontconfig/d722f191fc173fb8c13c8ea6f285de40-le64.cache-4
geany   17502   me  mem    REG                8,5    19328    529007 /var/cache/fontconfig/a595ca43be94766bbfe429f07fba82d0-le64.cache-4
geany   17502   me  mem    REG                8,5    17216    529005 /var/cache/fontconfig/580bda594161061e6ef4cc8a4db09662-le64.cache-4
geany   17502   me  mem    REG                8,5    35584    529003 /var/cache/fontconfig/1dce2cb908b447e938fc03acd9b47fcf-le64.cache-4
geany   17502   me  mem    REG                8,5   209704    528920 /var/cache/fontconfig/e93c8d63f9026ff45792033b853adafb-le64.cache-4
geany   17502   me  DEL    REG                8,8            1221002 /usr/lib64/locale/locale-archive
geany   17502   me  mem    REG                8,8   121040    802287 /usr/lib64/libgraphite2.so.3.0.1
geany   17502   me  mem    REG                8,8    22616    801464 /usr/lib64/libXxf86vm.so.1.0.0
geany   17502   me  DEL    REG                8,8             835089 /usr/lib64/libxcb-glx.so.0.0.0
geany   17502   me  mem    REG                8,8   149736    801100 /usr/lib64/libglapi.so.0.0.0
geany   17502   me  mem    REG                8,8    22504    801439 /usr/lib64/libXdmcp.so.6.0.0
geany   17502   me  mem    REG                8,8    14336    801434 /usr/lib64/libXau.so.6.0.0
geany   17502   me  mem    REG                8,8    47408    800472 /usr/lib64/libdrm.so.2.4.0
geany   17502   me  mem    REG               8,10    71536    664243 /lib64/libudev.so.1.3.7
geany   17502   me  mem    REG                8,8    22856    801102 /usr/lib64/libgbm.so.1.0.0
geany   17502   me  DEL    REG                8,8             803116 /usr/lib64/libxcb-xfixes.so.0.0.0
geany   17502   me  DEL    REG                8,8             835088 /usr/lib64/libxcb-dri2.so.0.0.0
geany   17502   me  mem    REG                8,8     5864    801431 /usr/lib64/libX11-xcb.so.1.0.0
geany   17502   me  DEL    REG               8,10             691928 /lib64/libbz2.so.1.0.6
geany   17502   me  mem    REG                8,8   174112    802103 /usr/lib64/libexpat.so.1.6.0
geany   17502   me  mem    REG                8,8   372120    802652 /usr/lib64/libharfbuzz.so.0.923.0
geany   17502   me  mem    REG                8,8    30904    802115 /usr/lib64/libffi.so.6.0.1
geany   17502   me  DEL    REG               8,10             653145 /lib64/libresolv-2.16.so
geany   17502   me  DEL    REG               8,10             653131 /lib64/librt-2.16.so
geany   17502   me  mem    REG                8,8   392984    274704 /usr/lib64/opengl/xorg-x11/lib/libGL.so.1.2.0
geany   17502   me  mem    REG               8,10    88472    660612 /lib64/libz.so.1.2.8
geany   17502   me  DEL    REG                8,8             835090 /usr/lib64/libxcb.so.1.1.0
geany   17502   me  DEL    REG                8,8             835084 /usr/lib64/libxcb-render.so.0.0.0
geany   17502   me  DEL    REG                8,8             803129 /usr/lib64/libxcb-shm.so.0.0.0
geany   17502   me  mem    REG                8,8   220184    801044 /usr/lib64/libpng16.so.16.8.0
geany   17502   me  DEL    REG               8,10             653143 /lib64/libdl-2.16.so
geany   17502   me  mem    REG                8,8   122528    265129 /usr/lib64/opengl/xorg-x11/lib/libEGL.so.1.0.0
geany   17502   me  mem    REG                8,8   617088    802753 /usr/lib64/libpixman-1.so.0.30.2
geany   17502   me  mem    REG                8,8   675336    802153 /usr/lib64/libfreetype.so.6.10.1
geany   17502   me  mem    REG                8,8    73544    801440 /usr/lib64/libXext.so.6.4.0
geany   17502   me  mem    REG                8,8    10120    801438 /usr/lib64/libXdamage.so.1.1.0
geany   17502   me  mem    REG                8,8    10096    801436 /usr/lib64/libXcomposite.so.1.0.0
geany   17502   me  mem    REG                8,8    43512    801437 /usr/lib64/libXcursor.so.1.0.2
geany   17502   me  mem    REG                8,8    39040    801450 /usr/lib64/libXrandr.so.2.2.0
geany   17502   me  mem    REG                8,8    63752    801444 /usr/lib64/libXi.so.6.1.0
geany   17502   me  mem    REG                8,8    10264    801445 /usr/lib64/libXinerama.so.1.0.0
geany   17502   me  mem    REG                8,8    39280    801451 /usr/lib64/libXrender.so.1.3.0
geany   17502   me  mem    REG                8,8   244520    802134 /usr/lib64/libfontconfig.so.1.7.0
geany   17502   me  mem    REG                8,8    85576    835142 /usr/lib64/libpangoft2-1.0.so.0.3400.1
geany   17502   me  mem    REG                8,8   146808    787175 /usr/lib64/libatk-1.0.so.0.20809.1
geany   17502   me  mem    REG                8,8    22432    801441 /usr/lib64/libXfixes.so.3.1.0
geany   17502   me  mem    REG                8,8  1285592    801432 /usr/lib64/libX11.so.6.3.0
geany   17502   me  DEL    REG               8,10             653151 /lib64/libc-2.16.so
geany   17502   me  DEL    REG               8,10             653130 /lib64/libpthread-2.16.so
geany   17502   me  mem    REG               8,10    88288    653223 /lib64/libgcc_s.so.1
geany   17502   me  DEL    REG               8,10             653136 /lib64/libm-2.16.so
geany   17502   me  mem    REG                8,8   995576   1188464 /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.3/libstdc++.so.6.0.17
geany   17502   me  mem    REG                8,8  1201112    802221 /usr/lib64/libglib-2.0.so.0.3600.4
geany   17502   me  mem    REG                8,8    14440    802228 /usr/lib64/libgmodule-2.0.so.0.3600.4
geany   17502   me  mem    REG                8,8   326656    802262 /usr/lib64/libgobject-2.0.so.0.3600.4
geany   17502   me  mem    REG                8,8  1409968    802210 /usr/lib64/libgio-2.0.so.0.3600.4
geany   17502   me  mem    REG                8,8   310536    835144 /usr/lib64/libpango-1.0.so.0.3400.1
geany   17502   me  mem    REG                8,8   130184    835186 /usr/lib64/libgdk_pixbuf-2.0.so.0.2800.2
geany   17502   me  mem    REG                8,8  1137752    801936 /usr/lib64/libcairo.so.2.11200.14
geany   17502   me  mem    REG                8,8    52392    835143 /usr/lib64/libpangocairo-1.0.so.0.3400.1
geany   17502   me  mem    REG                8,8   736376    802180 /usr/lib64/libgdk-x11-2.0.so.0.2400.22
geany   17502   me  mem    REG                8,8  4378920    802354 /usr/lib64/libgtk-x11-2.0.so.0.2400.22
geany   17502   me  DEL    REG               8,10             653152 /lib64/ld-2.16.so
geany   17502   me  mem    REG                8,5     7992    528210 /var/cache/fontconfig/711dae798b6bff4224ea2776edcb5c93-le64.cache-4
geany   17502   me  mem    REG                8,5     5344    529012 /var/cache/fontconfig/f55bbeb01d684dc5b5f7b2c347cc42d9-le64.cache-4
geany   17502   me  mem    REG                8,5   121856    528921 /var/cache/fontconfig/4b5cf4386f1cde02a336ba961b4ac82d-le64.cache-4
geany   17502   me  mem    REG                8,5   467824    528913 /var/cache/fontconfig/17090aa38d5c6f09fb8c5c354938f1d7-le64.cache-4
geany   17502   me  mem    REG                8,5   468544    528912 /var/cache/fontconfig/df311e82a1a24c41a75c2c930223552e-le64.cache-4
geany   17502   me  mem    REG                8,8   333636    568807 /usr/share/fonts/dejavu/DejaVuSansMono.ttf
geany   17502   me  mem    REG                8,8   134644    542662 /usr/share/mime/mime.cache
geany   17502   me  mem    REG                8,3    17724   2887683 /home/me/.local/share/mime/mime.cache
geany   17502   me  mem    REG                8,8     1584    647916 /usr/share/vte/termcap-0.0/xterm
geany   17502   me  mem    REG                8,5    13800    528154 /var/cache/fontconfig/aecded52ccf112ce9ddb976f75eab3bb-le64.cache-4
geany   17502   me  mem    REG                8,5    43352    527867 /var/cache/fontconfig/12b26b760a24f8b4feb03ad48a333a72-le64.cache-4
geany   17502   me  mem    REG                8,5     3744    528919 /var/cache/fontconfig/6ba42ae0000f58711b5caaf10d690066-le64.cache-4
geany   17502   me  mem    REG                8,5     5568    528918 /var/cache/fontconfig/9ac117a19f6581c07dc6f3cd1c903930-le64.cache-4
geany   17502   me  mem    REG                8,5    63936    528917 /var/cache/fontconfig/f73c51d6200a78c2054c26a5b2398976-le64.cache-4
geany   17502   me  mem    REG                8,5    32968    528916 /var/cache/fontconfig/d62e99ef547d1d24cdb1bd22ec1a2976-le64.cache-4
geany   17502   me  mem    REG                8,5    16824    527827 /var/cache/fontconfig/f6b893a7224233d96cb72fd88691c0b4-le64.cache-4
geany   17502   me  mem    REG                8,5    34008    528914 /var/cache/fontconfig/f349e9996a5320f6dd491cedd2b1f964-le64.cache-4
geany   17502   me  mem    REG                8,3     4664   2925817 /home/me/.cache/fontconfig/e62d3f7bf4c215071e5515a94c2f2165-le64.cache-4
geany   17502   me  mem    REG                8,5    12192    528911 /var/cache/fontconfig/3830d5c3ddfd5cd38a049b759396e72e-le64.cache-4
geany   17502   me  DEL    REG                8,8            1220999 /usr/lib64/gconv/gconv-modules.cache
geany   17502   me    0u   CHR             136,13      0t0        16 /dev/pts/13
geany   17502   me    1u   CHR             136,13      0t0        16 /dev/pts/13
geany   17502   me    2u   CHR             136,13      0t0        16 /dev/pts/13
geany   17502   me    3u  unix 0xffff8801deefb400      0t0  54793415 socket
geany   17502   me    4u  0000                0,9        0      5383 anon_inode
geany   17502   me    5u  unix 0xffff8801deefa080      0t0  54793417 /tmp/geany_socket.539baec2
geany   17502   me    6r  0000                0,9        0      5383 anon_inode
geany   17502   me    7u  unix 0xffff8801fbe14440      0t0  54786886 socket
geany   17502   me    8u  0000                0,9        0      5383 anon_inode
geany   17502   me    9u  0000                0,9        0      5383 anon_inode
geany   17502   me   10u   CHR                5,2      0t0      1137 /dev/ptmx
geany   17502   me   11u   CHR             136,17      0t0        20 /dev/pts/17
geany   17502   me   12u  unix 0xffff8801fd275b00      0t0  54802777 socket
geany   17502   me   13u  0000                0,9        0      5383 anon_inode
geany   17502   me   14r   REG                0,3        0  54819383 /proc/17502/mounts
geany   17502   me   18w  FIFO                0,8      0t0 120077341 pipe
geany   17502   me   19r  FIFO                0,8      0t0 120077342 pipe
geany   17502   me   21r  FIFO                0,8      0t0 120076496 pipe
geany   17502   me   22r  FIFO                0,8      0t0 120077343 pipe
  • Do I understand correctly that the write went to a pipe (sort)? In that case you might want to start by killing the process to which it was written before attempting anything else (like attaching with a debugger and messing around with the hanging syscall). – peterph Jan 15 '14 at 16:46
  • That's my understanding, although I'm not familiar with the exact workings of the "custom command" processing in geany. However, I can't find sort currently running. I've edited in the lsof output if that helps any. – ND Geek Jan 15 '14 at 16:58
  • ps --forest might be helpful (if your ps has it), ideally ps fux - you should be able to spot any processes spawned by your editor more easily. You may also try to run another instance of the editor and try something similar after you attach with either strace or debugger. – peterph Jan 15 '14 at 17:40
  • I was able to track down a /bin/bash process launched by geany using ps fux and kill it, which freed geany to continue. I do still wonder whether or not a syscall can be closed/killed independently of killing the entire process, though, or how difficult using a debugger to do that would be. – ND Geek Jan 15 '14 at 18:00
  • You might want to ask another question regarding interrupting a syscall (without the process list etc.) - I'm curious too. – peterph Jan 15 '14 at 19:02
1

If your program spawned another process which for some reason doesn't respond, the easiest way is to kill the unresponsive process. Using ps --forest or any other utility that is able to display the process tree helps to locate the exact target.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.