Menu

#538 After running dosemu -t terminal is unsane

fixed_in_git
closed
None
5
2014-08-08
2014-06-09
Andrew Bird
No

Hi all,
With current devel I find that after running "dosemu -t" the terminal is not working properly. If I type blind 'stty sane' then normal function returns. I'm sure this was working a little while back and I'm wondering if it's fallout from fixing my PIT timing bug as these messages now appear at exit.

ERROR: HLT on detached thread
ERROR: leavedos called recursively, forgetting the graceful exit!

Discussion

  • Stas Sergeev

    Stas Sergeev - 2014-06-10

    Hmm, I can't reproduce.
    Is the error msg right on startup, or on exit?
    How to reproduce?

     
  • Andrew Bird

    Andrew Bird - 2014-06-10

    Hi Stas,
    It seems to only occur when running a command non interactively i.e. on the dosemu command line

    bash-4.2$ bin/dosemu.bin -n --Fimagedir tmp-image -t -I "cpuemu off video{vga}" "dir /w"
    ERROR: SYSCALL ERROR: 13, *Permission denied* in file mouseint.c, line 527: expr=
            open(mice->dev, mode)
    ERROR: Cannot open internal mouse device /dev/input/mice
    ALSA lib rawmidi_hw.c:233:(snd_rawmidi_hw_open) open /dev/snd/midiC0D0 failed: No such file or directory
    
    ERROR: HLT on detached thread
    ERROR: leavedos called recursively, forgetting the graceful exit!
    

    If I run the same interactively then the terminal settings are restored correctly.

    Hope it helps,

    Andrew

     
  • Stas Sergeev

    Stas Sergeev - 2014-06-10

    -D9+hg please

     
  • Andrew Bird

    Andrew Bird - 2014-06-10

    Hi Stas,
    Here's the extra log. I just had a thought though, in autoexec.bat I wrap the
    unix -e call with callgrind instrumentation on/off calls. At the moment there's no callgrind running so callgrind_control might return non zero. Would that make a difference?

    e.g. in autoexec.bat

    prompt $P$G                                                                     
    path c:\bin;c:\gnu;c:\dosemu                                                    
    unix -s DOSEMU_VERSION                                                          
    unix callgrind_control --instr=on                                               
    unix -e                                                                         
    unix callgrind_control --instr=off
    
     
  • Andrew Bird

    Andrew Bird - 2014-06-10

    Just to answer my own question. I commented the 'unix callgrind_control' lines and the terminal insane problem persists.

     
  • Stas Sergeev

    Stas Sergeev - 2014-06-10

    OK, my optimization seems to opened a race
    condition. Now I have to re-introduce the
    "unoptimized" version of vm86() too. :(
    I still can't reproduce, so please try the
    attached patch.

     
  • Andrew Bird

    Andrew Bird - 2014-06-10

    Hi Stas,
    I now get an abort. I've attached the new boot_-D9+hg.log

    DOSEMU 1.4.0.8-707-g26afabe (2014-06-08), configured: 2014-06-10 14:37:47 +0100
    Please test against a recent version before reporting bugs and problems.
    Submit Bugs & Patches to linux-msdos@vger.kernel.org or via http://dosemu.org.
    FreeDOS kernel build 2036 cvs [version Aug 18 2006 compiled Aug 18 2006]
    Kernel compatibility 7.10 - WATCOMC - 80386 CPU required - FAT32 support
    
    (C) Copyright 1995-2006 Pasquale J. Villani and The FreeDOS Project.
    All Rights Reserved. This is free software and comes with ABSOLUTELY NO
    WARRANTY; you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation;
    either version 2, or (at your option) any later version.
    C: HD1, Pri[ 1], CHS=    0-1-1, start=     0 MB, size=  2000 MB
    
    FreeCom version 0.84-pre2 XMS_Swap [Aug 28 2006 00:29:00]
    C:\>prompt $P$G
    C:\>path c:\bin;c:\gnu;c:\dosemu
    C:\>unix -s DOSEMU_VERSION
    C:\>rem unix callgrind_control --instr=on
    C:\>unix -e
    About to Execute : dir/w
    dosemu.bin: do_vm86.c:445: vm86_helper: Assertion `in_dpmi_dos_int' failed.
    Aborted
    
     
  • Andrew Bird

    Andrew Bird - 2014-06-10

    Hi Stas,
    That fixes it, although it seems to have a slight performance cost. My test program took 158 secs with current devel and 160 secs after applying the patch.

    I've attached the log again

     
  • Stas Sergeev

    Stas Sergeev - 2014-06-10

    Applied, thanks.
    No, I don't think this can give a
    performance regression. The new helper
    only gets called from leavedos().
    Maybe some other recent patch did, but
    not this one.

     

    Last edit: Stas Sergeev 2014-06-10
  • Stas Sergeev

    Stas Sergeev - 2014-06-10
    • status: open --> closed
    • assigned_to: Stas Sergeev
     
  • Andrew Bird

    Andrew Bird - 2014-06-10

    Hi Stas,
    Later, when profiling under callgrind, I saw this with the latest devel:

    dosemu.bin: coopth.c:794: ensure_single: Assertion `thr->cur_thr == 1' failed.
    /home/ajb/run.sh: line 17: 10981 Killed                  /opt/valgrind/bin/valgrind --tool=callgrind --log-file=run.log --dump-every-bb=10000000 --instr-atstart=no --read-var-info=yes --separate-callers=5 --separate-recs=10 -v bin/dosemu.bin -n --Fimagedir tmp-image -t -I "cpuemu off video{vga} dpmi off" "test 1"
    

    I'm not sure if it's reproduceable whilst the dosemu logging is running

     

    Last edit: Andrew Bird 2014-06-10
  • Stas Sergeev

    Stas Sergeev - 2014-06-10

    Could you please reproduce the problem
    with the attached patch?
    Hmm, this coopthreads are becoming nasty.

     
  • Andrew Bird

    Andrew Bird - 2014-06-10

    Hi Stas,
    A shorter test exited with thr->cur_thr=2. I attached the log also

     
  • Stas Sergeev

    Stas Sergeev - 2014-06-10

    -D9+hg please.

     
  • Andrew Bird

    Andrew Bird - 2014-06-10

    Hi Stas,
    Here you go.

     
  • Stas Sergeev

    Stas Sergeev - 2014-06-10

    Please use the attached logging patch.

     
  • Andrew Bird

    Andrew Bird - 2014-06-10

    Hi Stas,
    Here's a thought. Are you sure the thread ID should always be 1? I was playing with helgrind on dosemu a couple of days ago and I seem to remember that the threads were initialised in different orders sometimes?

     
  • Stas Sergeev

    Stas Sergeev - 2014-06-10

    This is not an ID, this is a recursion
    counter. For some reason you have recursion
    level of inte6 = 2. This is likely a bug
    somewhere. I don't think inte6 should ever
    re-enter.

     
  • Andrew Bird

    Andrew Bird - 2014-06-10

    Stas,
    Here's the new log.

     
  • Stas Sergeev

    Stas Sergeev - 2014-06-10

    Thanks.
    I added a bit more logging to git.
    Please pull and re-do the log
    Together with the patch that was here.
    But please add a missing \n to the
    a.diff that I forgot to add.

     
  • Andrew Bird

    Andrew Bird - 2014-06-10

    Hi Stas,
    Here's the new log after pull

     
  • Stas Sergeev

    Stas Sergeev - 2014-06-10

    Should now be fixed in git.
    There are still coopth-unsafe places around,
    perhaps. Only a good testing can locate all
    of them, even though nothing have popped up
    for quite some time.

     
  • Andrew Bird

    Andrew Bird - 2014-06-10

    Hi Stas,
    That seems to be okay now. I'll let you know if I come across any others.

    Many thanks,

    Andrew

     
  • Stas Sergeev

    Stas Sergeev - 2014-06-10

    Thanks for testing.
    dosemu "dir /p"
    or
    dosemu exitemu
    were still unsafe.
    Should now be fixed completely.

     

Log in to post a comment.