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

Possible race condition with events #152

Open
cristianoccazinsp opened this issue Jul 13, 2019 · 4 comments
Open

Possible race condition with events #152

cristianoccazinsp opened this issue Jul 13, 2019 · 4 comments

Comments

@cristianoccazinsp
Copy link

The code samples hint that you should first await startUpload to get the id, and then add the listeners. However, if for some reason the upload fails right away (e.g., file is too large), the error events will not fire for that specific ID (because the listener wasn't added yet). So in this case you will never know if the request failed or not.

@TSMMark
Copy link
Contributor

TSMMark commented Jul 15, 2019

Thanks for reporting this issue. Is this a problem with the code samples and there is a workaround, or it's an API issue? When the upload fails right away is an exception raised or does it fail silently?

Do you have any thoughts about a potential solution?

@cristianoccazinsp
Copy link
Author

cristianoccazinsp commented Jul 15, 2019 via email

@TSMMark
Copy link
Contributor

TSMMark commented Jul 15, 2019

No problem, I appreciate you taking the time to report these issues even tho it sounds like you have solved many of them in your fork.

delay to "_sendEventWithName" so it gives time for event listeners to be setup

Sounds like we just need a simple defer / setTimeout(..., 0) to allow the current call stack conclude before triggering the event. Should be easy enough — would accept a PR.

@aelitneg
Copy link

aelitneg commented Mar 10, 2020

Has any progress been made on this? I ran into this issue when S3 immediately rejects a PUT when the header signatures do not match. The request fails silently. My (very loose) work around is to register the error listener first. That seems to catch most of the failures.
I'm a JS guy, not a Java guy, but the fix doesn't seem difficult. If it's low priority on the project, maybe I take a stab at the PR.

EDIT: We were actually able to get around this by using a customUploadId and registering event listeners with null as the uploadId before we made the call to startUpload().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants