libwww-perl / libwww-perl/HTTP-Daemon

IO::Socket::SSL and HTTP::Daemon's select-sysread loop don't work well together [rt.cpan.org #52602]

Open
#19 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Perl
Stars
6
Forks
17
PR merge metrics
No merged PRs in 30d

Description

Migrated from rt.cpan.org#52602 (status was 'open')

Requestors:

  • mark@aufflick.com

From mark@aufflick.com on 2009-12-09 11:12:49
:

The below bug raised for HTTP::Daemon::SSL is actually a bug in the 
base HTTP::Daemon. You can rewrite the test server in the Perlmonks 
node using only HTTP::Daemon and the result is the same.


HTTP::Daemon::SSL hangs on largish (e.g. >37k or >67k) POST request.

Quoting zwon on perlmonks.org:

"It looks like select-sysread loop in HTTP::Daemon doesn't work 
correctly with IO::Socket::SSL. That's because select in _need_more 
tests real filehandle and sysread reads from IO::Socket::SSL object 
which is buffered, so

sysread($self, $_[0], 2048, length($_[0]))

may actually read more than 2048 bytes from the socket and 
subsequent 
select on socket will hang.

Removing Timeout [which avoids the select() altogether] as proposed by 
derby solves the problem."

Complete description in: http://www.perlmonks.org/?node_id=761270

From mark@aufflick.com on 2009-12-09 11:16:31
:

sorry - my mistake :(

From mark@aufflick.com on 2009-12-09 11:18:56
:

ok, i shouldn't be raising RT tickets this late.

so: the test case does work fine with just HTTP::Daemon, but it *is* an 
issue in the underlying HTTP::Daemon and IO::Socket::SSL which prevents 
HTTP::Daemon::SSL from working with large posts.


From mark@aufflick.com on 2009-12-09 12:02:17
:

FYI - I'm testing re-introducing the _need_more method which was in 
HTTP::Daemon::SSL 1.03 to work around this. This has other issues (not 
least of which is breaking abstraction).

http://github.com/aufflick/p5-http-daemon-
ssl/commit/021ac9373855e7b99a1fd5b44c14537c950a0dd6

On Wed Dec 09 06:18:56 2009, AUFFLICK wrote:
> ok, i shouldn't be raising RT tickets this late.
> 
> so: the test case does work fine with just HTTP::Daemon, but it *is* an 
> issue in the underlying HTTP::Daemon and IO::Socket::SSL which 
prevents 
> HTTP::Daemon::SSL from working with large posts.




Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the large POST hang described for HTTP::Daemon with IO::Socket::SSL, then inspect HTTP::Daemon's select-sysread loop and the _need_more behavior mentioned in the report. Add a regression test for a large POST and confirm the server completes the request without hanging.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.