-
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
URLSessionTask: implement InputStream #1629
URLSessionTask: implement InputStream #1629
Conversation
@swift-ci please test |
1 similar comment
@swift-ci please test |
@swift-ci please test |
@swift-ci please test |
1 similar comment
@swift-ci please test |
@albertaleksieiev For me personally it looks great, and compiling a custom version of Swift with your change caused our Vapor app to finally stop randomly crashing in production, so huge thanks for that! But I have no power here 🤣 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, solved all my issues.
@Cellane I am happy to hear it 🤗 |
@Cellane what type of the problem do you have before? It may be a memory problem because without InputStream you need to load an entire object in memory it may cause OOM. |
@ianpartridge do you think this is ready to go? |
@albertaleksieiev I’m not quite sure, we just saw random crashes and restarts in the server log, but we failed to investigate if any particular request handler was causing it. Personally, my suspicion was on request handlers that accept images and upload them to S3, but I don’t have anything to back that claim up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this work! I've put a few thoughts in.
@ianpartridge thanks for your review, I will fix it soon! |
Could we merge it? I guess a lot of people is waiting for that. |
@robipresotto I'll commit latest changes in a few days(most likely at weekends). |
@albertaleksieiev This PR now has conflicts, I would suggest rebasing it on |
…nto url-session-task/input-stream # Conflicts: # TestFoundation/HTTPServer.swift
@spevans fixed! Thanks for the quick reply :) |
@swift-ci test |
We can resolve it. Current libcurl only use And if URLSession:task:needNewBodyStream delegate is setted we can rewind it back. |
Oh, I little bit was wrong here, we just need to seek forward InputStream 🙂 We assume that URLSession:task:needNewBodyStream provides new InputStream at position 0. |
@spevans can you please trigger a CI, thanks 🤗 |
@swift-ci please test |
It seems that
I took it from here, am I doing something wrong? 😅 |
I just get rid of |
@swift-ci test |
How is this PR related to #1667 ? |
@ddunbar It's not related to your mentioned PR at all. Here we need to |
Probably I can leave |
Hey Guys - We are experiencing the issue below in a swift server-side application.
It looks like the PR will fix the issue and wondering if someone could help me to build a swift docker image with this PR merged so we can test it properly before merging it on master. |
@robipresotto just reboot your app for example every 5 minutes, I am not joking, because otherwise I have a non working simple app with http protocol, I do it with all my linux projects based on swift and URLSession. Really cool, I am right ? =) |
Can someone please trigger a CI? Thanks 🙂 |
@swift-ci test |
Ship it 😅 |
@ianpartridge What to do next? 🙃Or may someone else know? |
Could we merge it? |
@swift-ci test and merge |
Thanks to everyone 🙌 |
Can you cherry-pick this to |
@ianpartridge for sure 👍 |
Allows using InputStream in URLRequest as
httpBodyStream
. Also, implementseekInputStream
in NativeProtocol.Also added test
test_dataTaskWithHttpInputStream
for URLSession.