Uploaded image for project: 'Axis'
  1. Axis
  2. AXIS-2574

Reading an attachment (slowly) can cause resource deleted error

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.2.1
    • None
    • Basic Architecture
    • None

    Description

      When reading the data from an attachment we periodically get the following error:

      java.io.IOException: Resource has been deleted.
      at org.apache.axis.attachments.ManagedMemoryDataSource$Instream.read(ManagedMemoryDataSource.java:688)

      Having run this throught a debugger and had a brief look at the code it seems to me there is a race condition of sorts.
      The MemoryManagedDataSource that provides the InputStream has been marked as deleted by the finalize method of AttachmentPart.
      So basically if the client doesn't read off the attachment fast enough then the writer will have finished and the AttachmentPart gets finalized and blam, you've got a deleted MemoryManagedDataSource.

      I'm not sure what the best fix is. Perhaps the deletion should actually be some reference count rather than a simple boolean. That way the MemoryManagedDataSource gets deleted once all the writers and readers are done? Although perhaps then there would be an issue if the client was very slow to even open the attachment?

      Attachments

        1. Call.diff
          2 kB
          Rodrigo Ruiz
        2. Call.diff
          10 kB
          Rodrigo Ruiz
        3. Call.java
          116 kB
          Rodrigo Ruiz
        4. axis-2574.patch
          2 kB
          Jochen Wiedmann

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jochen@apache.org Jochen Wiedmann
            ssowerby Steve Sowerby
            Votes:
            7 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment