Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-4268

NULL handle during ARCHIVE stage of workflow step, and when an e-mail should be sent

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Volunteer Needed (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 6.3
    • Fix Version/s: None
    • Component/s: DSpace API
    • Labels:
    • Attachments:
      0
    • Comments:
      0
    • Documentation Status:
      Needed

      Description

      E-mails sent from DSpace are not presenting the correct URI.

      Example e-mail content:

       

      Subject: DSpace: Submission Approved and Archived
      Date: Mon, 3 Jun 2019 20:19:34 +0000
      
      You submitted: test item 3
      
      To collection: Test collection2
      
      Your submission has been accepted and archived in DSpace, and it has been assigned the following identifier:
      http://hdl.handle.net/null
      
      Please use this identifier when citing your submission.
      
      Many thanks!
      DSpace

       

      I have isolated the problem to (during WFSTATE_ARCHIVE):

      https://github.com/DSpace/DSpace/blob/dspace-6.3/dspace-api/src/main/java/org/dspace/workflowbasic/BasicWorkflowServiceImpl.java#L814

       

      The handleService.findHandle call does not return a handle (returns NULL) because the handle has not yet been committed to the database.

      The handle can be retrieved by appending the following after that call:

       

      if (handle == null) {
        handle = item.getHandle();
      }

       

       

      But this is not ideal as it assumes the handle will be saved to the database.

       

      It seems that in both cases the e-mail is sent before the submission is fully completed.

      If the e-mail was sent after the submission was finished, then that extra line of code would be unneeded.

      More specifically, if the submission fails at a later point an e-mail will have already been sent (giving the recipient of the e-mail the wrong impression that the submission is completed). 

      Sending the e-mail after this step would be ideal: https://github.com/DSpace/DSpace/blob/dspace-6_x/dspace-api/src/main/java/org/dspace/submit/step/CompleteStep.java#L103

       

      To observe this behavior:

      1) add some logging before/after the relevant lines of code or enabling debugging in the logs.

      2) add some sleep commands before/after the relevant lines of code.

      2) create a new submission without finalizing.

      3) review the logs to get the uuid of the in-progress submission.

      4) add a watch every one second in the Postgresql for the handle table, selecting the uuid.

       

      select * from handle where resource_id = 'UUID_HERE';
      \watch 1
      

       

      5) finalize the submission, and observe the state of the handle table and compare the timestamps between the logs and the Postgresql watch results.

       

      I have consistently observed that the handle does not exist until the CompleteStep, which is long after the e-mail is sent. The e-mail is simply being sent too early in the process!

       

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            kday Kevin Day
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: