bugGNU Screen - Bugs: bug #27061, immediately-exiting programs lose...

 
 

bug #27061: immediately-exiting programs lose output?

Submitter:  Micah Cowan <micahcowan>
Submitted:  Mon 20 Jul 2009 09:03:43 PM UTC
   
 
Category:  Program Logic Severity:  3 - Normal
Priority:  * 7 - High Status:  Ready For Test
Privacy:  Public Assigned to:  gedge
Open/Closed:  Closed Release:  Cur Dev Sources
Fixed Release:  4.1.0 Planned Release:  None
Work Required:  0 - Hours
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 29 Jan 2013 07:56:13 AM UTC, comment #6: 

If the problem is that a child may perform I/O to its window followed by exiting, but that screen may handle the SIGCHLD before the I/O, would it make sense to:

  • set a flag on SIGCHLD


  • use a 0 timeout rather than a ten second timeout, and if select() ever times out when the SIGCHLD flag has been set, to terminate?


I'd think that that would avoid truncated output, as well as avoid the issue of lingering for ten seconds.

Mark Schreiber <mark7b>
Tue 29 Jan 2013 07:36:58 AM UTC, comment #5: 

The change for this bug is problematic for people who run background programs from their shell.  I tend to fire up programs in the background (e.g. "leafpad &") and then want to be able to close the terminal used to launch leafpad without waiting around for ten seconds.  Screen was able to do that before this patch.

Mark Schreiber <mark7b>
Fri 19 Aug 2011 10:37:48 PM UTC, comment #4: 

fixed with commit 450e8f38d479dfb8f5b3151d1c0bdcc2e9c6c6cc

Geraint Edwards <gedge>
Group Member
Sat 11 Dec 2010 01:02:56 PM UTC, comment #3: 

When zombie resurrects quickly, remove possible legacy "destroy event".

Problem example:

1.  Enable zombie mode.
2.  Terminate the program running in a window (i.e. make the window a zombie) [1]
3.  Within 10 seconds, resurrect the window
4.  Observe:  once the 10s is up, the window (and any new processes in it!) are killed. [2]

Solution:  See enclosed patch, resurrection now removes the destroy event.

[1] if the zombie does not say 'Command detached...', then try again until it does ('Command terminated normally...' may not trigger the bug)

[2] resurrecting the destroyed window will probably cause it to be killed again, after a delay

(file #22179)

Geraint Edwards <gedge>
Group Member
Thu 17 Dec 2009 10:49:46 PM UTC, comment #2: 

Juergen's assumptions seem correct. I have checked in 33b7c9c [1], which waits 10 seconds after wait() before killing the window. However, if screen gets EOF for that window before that time, then it gets killed immediately. I was able to reproduce the initial problem, and can confirm that this change fixes the issue for me.

Comments/Suggestions/Criticisms about the change are very welcome.

Please reopen if the bug persists after the change.

[1] http://git.savannah.gnu.org/gitweb/?p=screen.git;a=commitdiff;h=33b7c9ca3968e42fdfb9c4e031434e4d87864146

Sadrul Habib Chowdhury <sadrul>
Group administrator
Fri 24 Jul 2009 01:53:04 PM UTC, comment #1: 

It is a race condition.

screen has two ways to shut down a window.
a) when the window filedescriptor signals eof in select().
b) when wait() returns the pid of the window process.

Whatever comes first kills the window or sends it into zombie mode.

I believe b) just should not shut down the window.
My assumption is that a) will happen shortly after b) in any case.

Juergen Weigert <jnweiger>
Group administrator
Mon 20 Jul 2009 09:03:43 PM UTC, original submission:  

with zombie-mode on, output seems to get truncated.

  C-a : screen sh -c 'echo foo; echo bar; echo baz'

produces nothing, while

  C-a : screen cat FILE

produces truncated output.

Also, exiting a shell with ^D produces a final prompt line of:

  micah$ xit

where it should say "exit".

Micah Cowan <micahcowan>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #22179:  0001-bug-27061-remove-possible-destroy-event-when-zombie-.patch added by gedge (423B - application/octet-stream - remove possible destroy event when zombie resurrects)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mark7b (Posted a comment)
  • -email is unavailable- added by gedge (Updated the item)
  • -email is unavailable- added by sadrul (Posted a comment)
  • -email is unavailable- added by jnweiger (Posted a comment)
  • -email is unavailable- added by micahcowan (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-08-19 gedge Assigned toNone gedge
        Open/ClosedOpen Closed
    2010-12-11 gedge Attached File- Added 0001-bug-27061-remove-possible-destroy-event-when-zombie-.patch, #22179
        Priority5 - Normal 7 - High
        StatusFixed Ready For Test
        Open/ClosedClosed Open
    2009-12-17 sadrul StatusConfirmed Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.1.0

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code