#1165 Application takes a long time to close (shutdown)

Branch_+_Trunk
open
None
7
2006-04-26
2006-02-14
Anonymous
No

I tested versions 2.4.4 (and several previous
versions), 2.5.2.0 and 2.5.3.1.
The delay occurs in every situation I tested; with or
w/o files loaded, toggling plugins, toggling archive
suport, toggling one instance only, both Unicode and
ANSI versions.

My system is Windows 2000 fully patched, but it occurs
in every XP Pro I tested, anyway.
I'm running Viruscan, and I couldn't test a system
without it...

Discussion

1 2 > >> (Page 1 of 2)
  • Kimmo Varis

    Kimmo Varis - 2006-02-15

    Logged In: YES
    user_id=631874

    Like I already wrote to Developers-forum, one suspect may be
    that WinMerge keeps script files open. See this line of code

    hFile=CreateFile(theScriptletList.GetAt(i), GENERIC_READ,
    FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);

    in Plugins.cpp / LoadTheScriptletList(). It would be
    interesting to know if it helps at all when sharing flags
    are changed to FILE_SHARE_READ | FILE_SHARE_WRITE.

     
  • Kimmo Varis

    Kimmo Varis - 2006-02-15
    • priority: 5 --> 7
     
  • Flávio Etrusco

    Flávio Etrusco - 2006-03-06

    Logged In: YES
    user_id=99702

    Dang, I didn't notice I was logged out :-(
    What are these scripts? Is there any other way to disable
    them - or possibly cancel this (d)effect?

     
  • Kimmo Varis

    Kimmo Varis - 2006-03-07

    Logged In: YES
    user_id=631874

    Script files are .sct files in Plugins -subfolder. So
    removing them could help.

     
  • Flávio Etrusco

    Flávio Etrusco - 2006-03-07

    Logged In: YES
    user_id=99702

    You're right, they're the culprits.
    Thanks a lot.

    However, the delay seems a bit exagerated to be just any
    thing going on on such small files, don't you think? Unless
    there's some racing condition (like an item being readded to
    a list or something). Do you listen to file modification
    notifications?
    Oddly enough the "editor addin" scriplet adds a much longer
    delay than the "insert date" one, even though both have the
    same number of methods...
    Can it be that the vbscript engine is being unloaded and
    reloaded for some reason?

     
  • Gal Hammer

    Gal Hammer - 2006-04-09

    Logged In: YES
    user_id=411238

    I am unable to reproduce it (Trunk/WinXp Pro). Is there a
    defined scenario which this happen?

     
  • Flávio Etrusco

    Flávio Etrusco - 2006-04-09

    Logged In: YES
    user_id=99702

    Having the script files (.sct) in place it's always
    reproducible.
    Notice that the delay doesn't happen for the main window to
    close, but for the process to terminate.

     
  • Gal Hammer

    Gal Hammer - 2006-04-10

    Logged In: YES
    user_id=411238

    I have the script files in place (./MergePlugins) and I used
    (insert time and make upper) them in order to make sure they
    are loaded. Still, closing WinMerge terminate the process in
    less than a one or two seconds delay which I think is
    acceptable.

    How many .SCT files do you have? Is there a way to tell
    which version the windows scripting host is?

     
  • Kimmo Varis

    Kimmo Varis - 2006-04-10

    Logged In: YES
    user_id=631874

    Virusscan may be another hint here; it propably is scanner
    which scans files when they are accessed/opened. So its easy
    to get some nasty situations with fileaccess sharing..

    There is no doubt current code is just stupid, but question
    is if we can fix it with little tweaking (allowing shared
    write access?) or do we have to just rewrite it to not keep
    files open all the time.

     
  • Gal Hammer

    Gal Hammer - 2006-04-23

    Logged In: YES
    user_id=411238

    It seem that the sole purpose of opening all the *.sct files
    is a simple file locking. The files are kept open so the
    user won't try to delete or move a file which will later
    might be called. I'm not familiar with Window's scriptlets
    so I can't tell if that lock is a must.

    We can register to file system events and monitor file
    creation or deletion and update the menu on-the-fly.

     
  • Kimmo Varis

    Kimmo Varis - 2006-04-23

    Logged In: YES
    user_id=631874

    I'm not familiar with Windows scripting either, but I dare
    to claim whole program running time locking is not needed.

    I don't see problem just getting rid of that locking. We can
    lock scripts while they are used. And indeed we propably
    should load them at first use. We could enumerate scripts
    when starting (file compare) but load actual scripts only
    when really needed.

    File monitoring is one solution. But it is quite bad in pre
    W2K windows versions (W98 is still supported..). If we just
    used XP features I'd have already implemented 'live' folder
    compare which detects file changes and new files..

     
  • Gal Hammer

    Gal Hammer - 2006-04-24

    Logged In: YES
    user_id=411238

    Okay. I'll start with removing the file locking and load the
    script file by demand. I'll then try to work with etrusco
    (who submited the bug report) to see if this reduce the
    shutdown time. If the lock is indeed the guilty, then we'll
    run other session to decide how to handle a file removal
    after it was enumerated.

     
  • Kimmo Varis

    Kimmo Varis - 2006-04-26
    • assigned_to: nobody --> galh
     
  • Kimmo Varis

    Kimmo Varis - 2006-04-26

    Logged In: YES
    user_id=631874

    Great. That sounds like a good plan. It is also a waste of
    resources to keep those script files loaded all the time.

    Gal, I'm assigning this item to you so you can alter its
    settings etc.

     
  • Flávio Etrusco

    Flávio Etrusco - 2006-04-26

    Logged In: YES
    user_id=99702

    Gal, unfortunately that modified executable you sent me
    doesn't fix the problem :-(

     
  • Gal Hammer

    Gal Hammer - 2006-04-28

    Logged In: YES
    user_id=411238

    I tried to reproduce the bug after an installation of
    mcafee viruscan (trial version) on a clean Windows XP pro
    without a success.

    What do you do with WinMerge before closing it? Can you
    please describe the steps you make when the bug occurs?

     
  • Flávio Etrusco

    Flávio Etrusco - 2006-04-28

    Logged In: YES
    user_id=99702

    I just found one strange thing: it seems the delay just
    occurs if I run WinMerge with full Administrator priviledges.
    If I use "Run As" and leave the "protect from unauthorized
    activity" option chcked or run with an unpriviledged user
    the delay doesn't occur!
    I've been searching for some tracing programs, but still I
    couldn't pinpoint anything. Any suggestions?

     
  • Gal Hammer

    Gal Hammer - 2006-04-29

    Logged In: YES
    user_id=411238

    I don't know if it can help, but you might want to try
    process explorer from sysinternals site
    (http://www.sysinternals.com/Utilities/ProcessExplorer.html)
    .

     
  • Flávio Etrusco

    Flávio Etrusco - 2006-05-02

    Logged In: YES
    user_id=99702

    Thanks, but unfortunately ProcessExplorer wasn't enough for
    me (as a matter of fact, it comes included in WinXP ;-)
    I've been searching for some app that shows what are the
    current wait for a thread...
    BTW, did you try reproducing the problem using an Admin account?

     
  • Kimmo Varis

    Kimmo Varis - 2006-05-02

    Logged In: YES
    user_id=631874

    You can view process threads in ProcessExplorer, it even
    shows you the callstack of every thread. So its easy to see
    what threads are doing. It also shows all process open
    handles. It would be especially interesting to know if one
    of (or all) script files have open handles after WinMerge
    GUI is closed (and process is still running).

    ProcessExplorer isn't the easiest tool but it is very
    powerfull with problems like this.

     
  • Gal Hammer

    Gal Hammer - 2006-05-02

    Logged In: YES
    user_id=411238

    I'm always use a priviliage user account. Are you running
    with "administrator" account?

     
  • Kimmo Varis

    Kimmo Varis - 2006-07-31

    Logged In: YES
    user_id=631874

    One thing we have forgot.. Does W2K have windows scripting
    host by default? If not, could it be there is some confusion
    when we try to load/unload scripts.

    Does anybody actually use those scripts for some really
    useful? There's no been new scripts submitted for us, no
    questions about scripts etc. And after all many users have
    disabled whole scripting host because of security problems
    (.vbs scripts in e-mails...).

    So maybe it would be best to just disable this whole
    scripting for now.

    As for version query, there seems to be key in registry:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Scripting
    Host\Locations
    which contains locations for cscript.exe and wscript.exe.
    then you can just use our VersionInfo -class to query
    version number.

     
  • Kimmo Varis

    Kimmo Varis - 2006-07-31

    Logged In: YES
    user_id=631874

    Ugh, looking at our scripting host detection code at
    plugins.cpp and IsWindowsScriptThere(), that code looks a
    big fragile to me. I'm not sure if its guaranteed enough to
    check only that autoregistering key points to valid file.

    Umm. Isn't that whole locking code in script loading broken.
    I haven't myself used those CSemaphore and CSingleLock MFC
    classes so maybe I'm totally wrong here. Code creates static
    CSemaphore, and gives it to CSingleLock, which increases
    "user count by one. But the thing is, semaphores are
    signaled when they are non-zero (semaphores are counter
    objects, still resources left?). So we have useless locking
    there.

    Ugh, that code really should be rewritten. But like I said
    already, if just disabling .sct script fixes this problem
    I'm ready to disable them.

     
  • Gal Hammer

    Gal Hammer - 2006-07-31

    Logged In: YES
    user_id=411238

    I use them from time to time. The "Make Upper" script is
    useful when comparing two INI files.

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks