promise icon indicating copy to clipboard operation
promise copied to clipboard

Fix race condition when pending Promise was resolved in other thread

Open alex-verve opened this issue 4 years ago • 2 comments

I had to pin pytest* deps to make tests working again (new versions of pytest-cov and pytest-asyncio are not supported by latest pytest version for pypy)

Fixes https://github.com/syrusakbary/promise/issues/87

Test failure (without fix) - https://travis-ci.org/github/syrusakbary/promise/builds/708825617 Test passed here (with fix) - https://travis-ci.org/github/syrusakbary/promise/builds/708827378

alex-verve avatar Jul 15 '20 22:07 alex-verve

There is at least one more race-condition in PromisList

  File "/var/task/promise/promise.py", line 97, in try_catch
    return (handler(*args, **kwargs), None)
, 
  File "/var/task/graphql/execution/executor.py", line 260, in <lambda>
    resolved
, 
  File "/var/task/graphql/execution/executor.py", line 288, in complete_value
    return complete_object_value(exe_context, return_type, field_asts, info, result)
, 
  File "/var/task/graphql/execution/executor.py", line 382, in complete_object_value
    return execute_fields(exe_context, return_type, result, subfield_asts)
, 
  File "/var/task/graphql/execution/executor.py", line 146, in execute_fields
    return promise_for_dict(final_results)
, 
  File "/var/task/promise/promise.py", line 816, in for_dict
    return cls.all(m.values()).then(handle_success)
, 
  File "/var/task/promise/promise.py", line 796, in all
    return PromiseList(promises, promise_class=cls).promise
, 
  File "/var/task/promise/promise_list.py", line 40, in __init__
    self._init(values)  # type: ignore
, 
  File "/var/task/promise/promise_list.py", line 72, in _init
    self._iterate(values)
, 
  File "/var/task/promise/promise_list.py", line 95, in _iterate
    None,

alex-verve avatar Aug 04 '20 09:08 alex-verve

Is there any update on this or any way to help out? This is a critical issue since we are using Promise for job scheduling in production, and every once in a while this error comes around and forces us to re-run

Zahlii avatar Sep 08 '20 05:09 Zahlii