Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M10 (2.0.0.v20151221-M10)
    • Fix Version/s: 2.0.0-M11, 2.0.0-M12
    • Component/s: studio-ldapbrowser
    • Labels:
      None
    • Environment:
      x86_64, Linux Debian 8, GTK

      Description

      Hello,
      perhaps I am wrong, but I suspect myself of seeing a bug in Apache Directory Studio 2.0.0.v20151221-M10.

      In method EntryEditorManager.updateAutoSaveSharedReferenceCopy (runs in main thread):

      Firstly:
      -> EntryEditorUtils.ensureAttributesInitialized(entry);
      -> StudioBrowserJob runs InitializeAttributesRunnable in a thread
      -> InitializeAttributesRunnable.run
      -> initializeAttributes( entry, monitor ) -> initializeAttributes( entry, returningAttributes, true, monitor )
      -> entry.deleteAttribute( oldAttribute ) -> ai.attributeMap.remove(Strings.toLowerCase(oidString));

      Secondly:
      -> new CompoundModification().replaceAttributes(entry, workingCopy, this);
      -> fromEntry.getAttributes() -> ai.attributeMap.values()

      Thus, the 1st thread modifies ai.attributeMap and at the same time the 2nd thread reads it. Only initializeAttributes is synchronized, but on its class object.

      Is it not a race condition?

      Thank you. With regards Vaclav Havlik.

        Activity

        Hide
        seelmann Stefan Seelmann added a comment -

        Thanks for ther report. I'll try to look into the code in the next days.

        Show
        seelmann Stefan Seelmann added a comment - Thanks for ther report. I'll try to look into the code in the next days.
        Hide
        havlikv Václav Havlík added a comment -

        And also
        EntryEditorUtils.updateAutoSaveSharedWorkingCopy .
        Here, there is no EventRegistry.suspendEventFiringInCurrentThread() .

        Show
        havlikv Václav Havlík added a comment - And also EntryEditorUtils.updateAutoSaveSharedWorkingCopy . Here, there is no EventRegistry.suspendEventFiringInCurrentThread() .
        Hide
        seelmann Stefan Seelmann added a comment -

        Fixed: http://svn.apache.org/viewvc?rev=1747922&view=rev

        Now we wait till attribute initialization is finished before continuing with changing the entry. Thanks for the report.

        Show
        seelmann Stefan Seelmann added a comment - Fixed: http://svn.apache.org/viewvc?rev=1747922&view=rev Now we wait till attribute initialization is finished before continuing with changing the entry. Thanks for the report.
        Hide
        havlikv Václav Havlík added a comment -

        But does not the RunnableContextRunner.run()
        run the InitializeAttributesRunnable in a new thread, eventually in
        ModalContext.run() ? Because "fork" is harcoded to true inside RunnableContextRunner.run( ) .

        So we don't wait, in fact?

        Show
        havlikv Václav Havlík added a comment - But does not the RunnableContextRunner.run() run the InitializeAttributesRunnable in a new thread, eventually in ModalContext.run() ? Because "fork" is harcoded to true inside RunnableContextRunner.run( ) . So we don't wait, in fact?

          People

          • Assignee:
            seelmann Stefan Seelmann
            Reporter:
            havlikv Václav Havlík
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development