#111 Segfault on interrupting an archive "delete update"

open
nobody
None
6
2011-03-15
2011-03-12
Anonymous
No

For instance, consider the following command :

$ 7z d LargeArchive.7z some/file/in/archive.foo

If this is interrupted ( say, using CTRL + C, or if the update callback's SetCompleted method returns E_ABORT ), p7zip segfaults.

This only appears to occur with updates involving deletion. While I haven't had time to investigate this, it appears to be a thread synchronization issue. Depending on how soon you interrupt the process, one of the following events can occur :

1. Everything goes fine. This only happens if you abort immediately, before the actual update starts.
2. Freezes ( I suspect due to a wait condition somewhere )
3. Segfaults

My environment : p7zip Version 9.13 (locale=utf8,Utf16=on,HugeFiles=on,2 CPUs) / Mac OS X 10.6.6 /

Discussion

  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous

    Anonymous - 2011-03-15
    • priority: 5 --> 6
     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous

    Anonymous - 2011-03-15

    Tested with v9.20 : Issue still exists.

     
  • Igor Pavlov

    Igor Pavlov - 2011-04-03

    Please try another way to fix that bug:

    1) Move CStreamBinder before CThreadDecoder:

    CStreamBinder sb;
    RINOK(sb.CreateEvents());
    CThreadDecoder threadDecoder;

    2) and add sb.ReInit():
    {
    CMyComPtr<ISequentialOutStream> sbOutStream;
    CMyComPtr<ISequentialInStream> sbInStream;
    sb.CreateStreams(&sbInStream, &sbOutStream);
    sb.ReInit();

    Does it work OK now?

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous

    Anonymous - 2011-04-03

    Moving CStreamBinder made it non-deterministic : it sometimes works, sometimes doesn't ( same old segfault in CThreadDecoder ).

    I suppose moving it fixes the destruction order but introduces a race condition?

     
  • Igor Pavlov

    Igor Pavlov - 2011-04-03

    Please add more patches:

    VirtThread.h:

    ~CVirtThread();
    WRes Create();
    void WaitThreadFinish();

    VirtThread.cpp:

    void CVirtThread::WaitThreadFinish()
    {
    ExitEvent = true;
    if (StartEvent.IsCreated())
    StartEvent.Set();
    if (Thread.IsCreated())
    {
    Thread.Wait();
    Thread.Close();
    }
    }

    CVirtThread::~CVirtThread()
    {
    WaitThreadFinish();
    }

    7zUpdate.cpp:
    ~CThreadDecoder()
    {
    WaitThreadFinish();
    }

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous

    Anonymous - 2011-04-03

    Patched : everything works fine now.

     

Log in to post a comment.