-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[storage-blob] processing downloadBlockBlobResponse.readableStreamBody stucks/hangs #16987
Comments
The Thanks |
@EmmaZhu ok will check |
Hi @AyushG25 I cannot see why it stuck with the code. Are you able to get a stack to see where it stucks? Thanks |
We have also experienced the same exact issue in production right after migrate to Node.js 14.17.3 from Node.js 12.13.0. @azure/storage-blob: 12.3.0 I have been investigated a bit and I believe the issue comes from a bug with the internal lib used to perform the download: node-fetch and changes in Node.js 14 streams behavior. For some reason the close and error event is not called and the application just exit. If your application have got more timers the stream will stuck/hang as you described. A similar issue has been fixed in node-fetch v3 node-fetch/node-fetch#1219. Still not ported in v2. If I test the same download process with just node-fetch I have got the same result as if I test with azure-storage blob download: Test with node-fetch 2.6.1, no event close emitted at all (process just exit)
Test with node-fetch 3.0.0-beta10, close and error events are emitted properly
The issue cannot be reproduced in Node.js 12 with the same version of the lib. Sometimes the download fails but at least get notified and the stream does not stuck. Hope this info can help. |
I'm seeing the exact same issue as described by AyushG25. My app just starts hanging after a while because the stream never completes or errors. It's just waiting indefinitely. Possibly related to #9929 because I'm downloading 10 blobs concurrently. |
I tried to repro the issue with downloading a 14MB blob with following code:
Tried several times, but didn't encounter a hang. @AyushG25 , did you try with upgrade node-fetch? Can this mitigate your issue? Thanks |
We changed our approach instead of streaming data directly from blob storage, now we are downloading the file and then processing it. We could not figure out the RCA. |
I'll try to repro the issue again. Did the issue happen consistently or randomly? |
I tried to repro the hang with Node 14.17.3 and typescript 4.2.4, but still cannot get a hang. @AyushG25 , I'll close this issue for now. If you'd need further assistant, please feel free to reopen it. |
Describe the bug
Trying to process a CSV file stored in azure blob storage of size 38MB (1.5-2 million rows) using
download
method anddownloadBlockBlobResponse.readableStreamBody
. My code pipes the readableStreamBody to a csvParser and then usingfor await
loop I try to process the stream row by row. In processing, I do some validations and DB operations. The processing of the file stops in between. Checked azure insights found error wrtGetBlobProperties
, attaching screenshot for the same. Not sure whyGetBlobProperties
was called so many times.Am I putting unnecessary load on BLOB storage with my below code
To Reproduce
Expected behavior
The processing of BLOB as readable stream should reach file end
Screenshots
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: