Skip to content

Conversation

vavrusa
Copy link
Contributor

@vavrusa vavrusa commented Jun 14, 2016

Current code throws an error when stream dependency is not currently in the stream, it should however be treated as default priority.

@daurnimator
Copy link
Owner

Ah, what a simple fix/solution.
Will merge once I do some testing.

@daurnimator
Copy link
Owner

Could you add a test case?

@coveralls
Copy link

coveralls commented Jun 14, 2016

Coverage Status

Coverage increased (+0.02%) to 87.178% when pulling 31b2906 on vavrusa:master into 111b0d0 on daurnimator:master.

@daurnimator
Copy link
Owner

it's okay to add tests in a separate commit :)

@vavrusa
Copy link
Contributor Author

vavrusa commented Jun 14, 2016

Sure, I just wasn't sure how to trigger this in tests using just library APIs, so I mocked the frame handler to inject a fake parent stream.

-- Check if not set to mocked priority
local ok, err = pcall(function()
local stream = assert(s:get_next_incoming_stream())
assert.is_not.same(stream.weight, 99)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make an effort to cleanly shut down streams: add s:shutdown() here.

@coveralls
Copy link

coveralls commented Jun 14, 2016

Coverage Status

Coverage increased (+0.2%) to 87.328% when pulling 70bb5ee on vavrusa:master into 111b0d0 on daurnimator:master.

@daurnimator
Copy link
Owner

Sure, I just wasn't sure how to trigger this in tests using just library APIs, so I mocked the frame handler to inject a fake parent stream.

On the other end of the pipe call stream:write_headers_frame() passing a weight

req_headers:append(":method", "GET")
req_headers:append(":scheme", "http")
req_headers:append(":path", "/")
assert(client_stream:write_headers(req_headers, false))
Copy link
Owner

@daurnimator daurnimator Jun 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please eagerly shutdown streams: client_stream:shutdown()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do, but don't they get closed when connection closes?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. but there are some things that can go wrong with that.
I've got some stuff (locally) that I use to try and find leaks of streams/connections.

Otherwise, in general I encourage use of stream:shutdown() to release resources as soon as possible. Relying on __gc for this isn't great, as lots of people don't realise they're still hanging on to a reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. I have a couple of socket leak bugfixes for server afterwards, but it needs more work to submit it in neater patches.

I wasn't thinking about __gc, just having a loop in h2_connection.close to go over all streams in self.streams and calling shutdown() on those not in closed state.

@coveralls
Copy link

coveralls commented Jun 14, 2016

Coverage Status

Coverage increased (+0.2%) to 87.328% when pulling c65c96a on vavrusa:master into 111b0d0 on daurnimator:master.

instead of throwing an error in stream handling,
the code follows section 5.3.1 and gives stream
default priority
@coveralls
Copy link

coveralls commented Jun 14, 2016

Coverage Status

Coverage increased (+0.3%) to 87.457% when pulling 48e70a5 on vavrusa:master into 111b0d0 on daurnimator:master.

@daurnimator
Copy link
Owner

Looks good now :) Will merge when I next work on lua-http (next day or two)

@vavrusa
Copy link
Contributor Author

vavrusa commented Jun 14, 2016

Thanks for helping me with the patch!

@daurnimator daurnimator merged commit 48e70a5 into daurnimator:master Jun 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants