Menu

Folder.Close(true) causes folder corruption

Help
RustyShelf
2005-06-29
2013-05-01
  • RustyShelf

    RustyShelf - 2005-06-29

    Hi Ben,

    Please let me know if you are sick of me pestering you.

    My problem is that when I delete some things from a folder, and then close it using the expunge flag:
    [folder object].close(true);
    The contents of my folder are corrupted (All of the messages remaining lose all of their content). I can reproduce this every time.

    I am using mstor v0.9.6 with the following settings:
    p.setProperty("mstor.mbox.useNioMapping", "false");
    p.setProperty("mstor.meta.enabled", "false");

    Any ideas?

    Rusty

     
    • Ben Fortuna

      Ben Fortuna - 2005-07-02

      Hi Rusty,

      I've just tried the following test, and it seems to work ok:

              URLName url = new URLName("mstor:c:/temp/mstor_test");
              Properties p = new Properties();
              // disable metadata..
              p.setProperty("mstor.meta.enabled", "false");
              p.setProperty("mstor.mbox.useNioMapping", "false");
              Store store = new MStorStore(Session.getDefaultInstance(p), url);
              store.connect();

              Folder inbox = store.getDefaultFolder().getFolder("Inbox");
              inbox.open(Folder.READ_WRITE);
              Message message = inbox.getMessage(1);
              message.setFlag(Flags.Flag.DELETED, true);
              inbox.close(true);

      Let me know how your code differs from this and I can try to replicate your problem.

      regards,
      ben

       
    • Ben Fortuna

      Ben Fortuna - 2005-07-02

      Rusty,

      I've just found a couple of things that could lead to data corruption in a multi-threaded environment (regarding the encoder/decoder and dateformat in the MboxFile). This may be the cause of the problem, but I can't guarantee it..

      regards,
      ben

       
    • RustyShelf

      RustyShelf - 2005-07-02

      Hi Ben,

      I wrote some test code (similar to what you have above, but with a folder of 50 or so messages, and more delete operations) and it appears to work fine.

      So then I checked my code again, and I found an issue where a thread was being kicked off before another one had finished. This was causing two threads to both trying using mstor at once, possibly even for the same folder. I found one other small issue with the way I was handling messages as well. It looks like one (or both) of these was the cause of my corruption issues...

      sorry for the confusion,

      Rusty

       
      • Ben Fortuna

        Ben Fortuna - 2005-07-02

        Hi Rusty,

        No worries. I hope to improve concurrency support in mstor, or at least document where classes are not thread-safe. If you have any suggestions or requests for improving synchronisation let me know.

        regards,
        ben

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.