Conversion of MessageBody to accept Pin in poll_next #1332
Conversion of MessageBody to accept Pin in poll_next #1332JohnTitor merged 32 commits intoactix:msg-bodyfrom
Conversation
|
Could you reword b55aa2e? Otherwise it'll close mentioned issue. |
e2e3915 to
cde68b5
Compare
- Convert MessageBody to accept Pin in poll_next - add CHANGES and increase versions aligned to semver - update crates to accomodate MessageBody Pin change - fix tests and dependencies
47a0082 to
20a18fb
Compare
Done, had to squash them but it seems no conflicts so ok |
|
After running benchmarks and separately load testing actix server with ab I do not see any significant difference in performance, pinned version seems working slightly faster but most likely it is just random variance: ApacheBenchmarkTests performed on ubuntu with 32GB RAM and 40 CPU Version from this branch using Pin in poll_next(): Version from master branch: cargo benchVersion with Pin: Version from Master: |
|
Rough reviews at this point:
At a glance, the benchmark you commented looks good to me, so the change should be fine roughly. |
|
@JohnTitor need your advice. I initially wanted to include only changes in actix-http and point rest of crates to version 1.0.1. Though it appeared problematic as there is dependency chain: To illustrate the issue I have just pushed commit pointing actix-http to actix-http-test:1.0.0: Problem is actix-http-test crate is used only to run some tests within actix-http crate, though if I do not provide updated version of awc and actix-web actix-http tests do not compile as they use different versions of structs and traits : actix-http:1.0.1 and actix-http:2.0.0. Once I update actix-web, crates actix-{identify, session} fail to compile. One possible solution is to move out actix-http tests which depend on actix-http-test crate. Another option would be to comment out those tests temporarily. |
|
One safe way is to prepare another branch and work there. You can ignore workspace members that don't compile there. I just prepared |
|
This is ready for review now with all 3 changes as requested. |
cdbattags
left a comment
There was a problem hiding this comment.
Small things but otherwise looks great
There was a problem hiding this comment.
Been thinkng about this for a couple days. It seems uneccesary to have MessageBody take the Unpin supertrait. You're handling the self Pin signatures correctly in most places anyway but it'll only takes a couple of modifications to make it work without the supertrait.
Eg. the Box and Box impls can use map_unchecked_mut calls. The h1 dispatcher maybe slightly more involved (just from changing a couple things) but given the h2 dispatcher is already using pin_project it seems achievable.
|
@robjtede I have unlinked MessageBody from Unpin as you suggested. h1::dispatcher appeared quite complicated and requires strong review. DispatcherState and SendResponse required some unsafe code too. |
|
@dunnock: I'm working on changes to |
|
@Aaron1011: If you mean taiki-e/pin-project#181 not sure how that will help here? FramedParts takes ownership of a stream, hence we are taking the |
|
@dunnock: This is different - this idea is to have a I haven't yet opened a PR for it, but I will soon. |
|
@Aaron1011 in our case current enum variant is Pinned ( |
|
Last commits getting rid of unsafe code in a dispatcher with Aaron's idea to transfer not pinned fields (DispatchInner::io, *_buf, codec). Note that Compared to current master this PR removes 4 unsafe blocks from dispatcher not adding any new. By benchmark it is still have no noticeable difference to the version in master: |
|
I'm liking the look of these changes @dunnock, thanks for putting the time in to this. Will give it a proper look over later today and resubmit review. |
|
Really good work; the tendrils of that trait ran much deeper than I thought. I'm glad we kept the Unpin only to necessary parts. |
Use Actions fully
|
@dunnock amazing work on this thanks for the time |
Disable coverage for PRs
|
@JohnTitor do you see any reason not to merge? would rather you took the lead here.. |
JohnTitor
left a comment
There was a problem hiding this comment.
Really great as a first step! I left a comment for a nit point.
JohnTitor
left a comment
There was a problem hiding this comment.
Sorry for the delay! Let's go ahead :)
Starting conversion of
MessageBodyto acceptpoll_next(self: Pin<&mut Self...)as it was adviced in #1321 (comment) .This is breaking change and probably should be included in the next version, amended versions accordingly.
Following versions updated as part of this PR to align with semver:
actix-http1 -> 2.0.0-alphaChecklist:
Move to another PR / tasks
actix-web2.0 -> 2.1 (probably should go to 3.0?)awc1 -> 2