sequenceserver icon indicating copy to clipboard operation
sequenceserver copied to clipboard

Sticky job_id prevents server from fetching databases

Open marcadella opened this issue 3 years ago • 5 comments

After doing a search the last job_id is stored in a cookie (I guess). But if the server is restarted at that point, the job_id doesn't exist anymore and the following Ajax request: https://mmp-blast.sfb.uit.no/searchdata.json?job_id=8dbf489f-f739-4321-9bf3-ff84af2cee86

returns:

{"message":"The requested job could not be found","title":"Job not found","more_info":""}

and the consequence is that the list of databases is not and the UI does not let a user submit a new query (since no db has been selected).

Sequenceserver should fail gracefully when a job_id does not exist.

marcadella avatar Jan 25 '22 07:01 marcadella

Agreed.

In the mean time, you have two options:

  1. Refreshing the page clears the job_id (it is stored in sessionStorage, btw)
  2. Open a new tab - since the job_id is stored in sessionStorage, it only persists in the current tab.

Note to my future self or anyone else who takes up this issue: The API endpoint should probably distinguish between XHR and non-XHR request. For XHR request, job_id should be ignored when it does not exist. For non-XHR request, we retain the current behaviour. Additionally, SequenceServer probably shows the above error message in a modal if the user goes to 'localhost:4567/?job_id=...' (if the error is not displayed in a modal, it should be). The modal should give the user an option to start a new search.

yeban avatar Jan 30 '22 12:01 yeban

@yeban The funny thing is that neither refreshing the page nor opening a new tab worked! The only solution that worked was to open a new incognito window (using chrome). That's why I assumed it was stored in a cookie.

marcadella avatar Feb 01 '22 21:02 marcadella

@marcadella Do you any see any error message in the browser console when you try to refresh? Which version of Chrome are you using?

yeban avatar Feb 09 '22 18:02 yeban

Ok, I get it know. I can see job_id in sessionStorage and it stays there when I reload the page (expected behavior for sessionStorage). I tried to open a new tab and it was cleared as expected.

So I just disagree with your solution 1 since sessionStorage is not cleared upon page reload.

marcadella avatar Feb 10 '22 17:02 marcadella

Hello. I am sorry, it's not currently possible for me to respond sooner.

If SequenceServer is not clearing sessionStorage for you on page refresh, then we have a bug (search.js#L12-18). But I cannot reproduce it on my end. Do you see any error message or warnings in the browser console that can help troubleshoot the issue? What version of Chrome are you using?

yeban avatar Feb 23 '22 17:02 yeban