Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix script results failures #87

Merged
merged 2 commits into from
Nov 28, 2019

Conversation

will-moore
Copy link
Member

This prevents multiple timeouts running at the same time, which allows several simultaneous calls
to get script results, causing race conditions.

See https://forum.image.sc/t/omero-scripts-producing-failed-to-get-results/31601

To test:

  • Run multiple scripts at once. E.g. Open lots of "Batch Image Export" script dialogs and then hit Run on all of them at once.
  • Should get all results returned as expected. No "Failed to get results" as described on forum.
  • Looking at the console Network tab, you should see that we only ping the server once every 5 secs. Previously, each script started it's own 5-second ping. So we were had multiple simultaneous calls to getResults(). Only the first call succeeded, but the Django request.session containing the results was over-written by the other request. E.g. as described at https://stackoverflow.com/questions/13748166/django-session-race-condition

This prevents multiple timeouts running at the same time, which allows several simultaneous calls
to get script results, causing race conditions.
@austinMLB
Copy link

I patched this into my version and could no longer reproduce the error I was seeing. I noticed that "activitiesInteval" should perhaps be "activitiesInterval" (missing 'r'), but I don't know the code well enough to comment on correctness. --Michael (original poster on the forum)

@will-moore
Copy link
Member Author

Thanks for the feedback @austinMLB. I fixed that typo and removed a stray console.log().

@will-moore will-moore changed the title Only create 1 activities timeout of 5 secs intervals Fix script results failures Nov 26, 2019
@pwalczysko
Copy link
Member

pwalczysko commented Nov 27, 2019

Repeating the problem on ome-training-4
Needs to select all the idr0021 datasets (10) and run 12 "simultaneous" as possible runs of Batch image export on all the 10 datasets.

Got one failure
Screen Shot 2019-11-27 at 11 56 45

During a repeat, got more failures.

And a server error when trying to clear the activities (this repeated as well):

Traceback (most recent call last):

  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)

  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)

  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)

  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omeroweb/decorators.py", line 485, in wrapped
    retval = f(request, *args, **kwargs)

  File "/opt/omero/web/venv3/lib64/python3.6/site-packages/omeroweb/webclient/views.py", line 3502, in activities_update
    for key, data in request.session['callback'].items():

RuntimeError: dictionary changed size during iteration

<WSGIRequest: POST '/webclient/activities_update/clean/'>

@pwalczysko
Copy link
Member

pwalczysko commented Nov 27, 2019

Unfortunately, on py3-ci, I am still getting the failures as well.

Screen Shot 2019-11-27 at 12 08 36

Nevertheless, I can clear the list of Activities on py3-ci without getting the server error as I did on ome-training-4 above #87 (comment) - so there is some improvement... possibly

@will-moore
Copy link
Member Author

Apologies @pwalczysko, it appears that again this PR wasn't included. Seems to be happening a lot these days.
Snoopy says:

Excluded PRs:
  - PR 87 will-moore 'Fix script results failures' (status: )

at snoopycrimecop@82bf95a
and indeed, this PR is not X but is not green either.

@will-moore will-moore closed this Nov 27, 2019
@will-moore will-moore reopened this Nov 27, 2019
@pwalczysko
Copy link
Member

This PR seems to be excluded again on snoopycrimecop@82bf95a ? I cannot see any apparent reason reported there for it.

@joshmoore
Copy link
Member

@pwalczysko : likely caused by a delayed job on py3-ci. Should be there now.

@pwalczysko
Copy link
Member

Repeated on py3-ci just now.

Batch image export run in close succession 18 times on the ca 400 images (executed on 10 datasets) of the idr0021 project.
No reported problems in the activities, all ended as expected.

The zips;were also created and attached as expected.
Clearing of tha Activities table went fine too.

Ready to merge FMPOV

@joshmoore joshmoore merged commit ed1f4f4 into ome:master Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants