Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Chick on July 04, 2011, 12:19:37 AM



Title: Bitcoin JSON RPC Connection gets reset by client...
Post by: Chick on July 04, 2011, 12:19:37 AM
Occasionally, PHP returns an error similar to this: "ErrorException [ Warning ]: fgets(): SSL: Connection reset by peer" when sending api commands to the bitcoin server. What can I do to resolve this issue?


Title: Re: Bitcoin JSON RPC Connection gets reset by client...
Post by: Chick on July 04, 2011, 04:03:35 AM
Bump.


Title: Re: Bitcoin JSON RPC Connection gets reset by client...
Post by: JoelKatz on July 04, 2011, 04:30:01 AM
This is legal behavior, and if it confuses some other code, that code is broken. See section 8.1.4.4 of the HTTP 1.1 specification: "A client, server, or proxy MAY close the transport connection at any time. ... This means that clients, servers, and proxies MUST be able to recover from asynchronous close events."

That said, the bitcoin client hopelessly bungles persistent and concurrent connections. A fix for this is one of the fixes in my '3diff' patch set. http://davids.webmaster.com/~davids/bitcoin-3diff.txt


Title: Re: Bitcoin JSON RPC Connection gets reset by client...
Post by: Chick on July 04, 2011, 05:29:19 AM
This is legal behavior, and if it confuses some other code, that code is broken. See section 8.1.4.4 of the HTTP 1.1 specification: "A client, server, or proxy MAY close the transport connection at any time. ... This means that clients, servers, and proxies MUST be able to recover from asynchronous close events."

That said, the bitcoin client hopelessly bungles persistent and concurrent connections. A fix for this is one of the fixes in my '3diff' patch set. http://davids.webmaster.com/~davids/bitcoin-3diff.txt


Thanks for clearing that up! The code isn't broken, but it's just a warning. It shouldn't interfere with anything in production.


Title: Re: Bitcoin JSON RPC Connection gets reset by client...
Post by: JoelKatz on July 04, 2011, 05:35:58 AM
Well, the code is broken, it mishandles persistent connections. But its breakage is manifesting in a way that is permitted by the standard. So if it affects other code, that code is broken too. :)

Thanks.


Title: Re: Bitcoin JSON RPC Connection gets reset by client...
Post by: Chick on July 04, 2011, 05:44:45 AM
Well, the code is broken, it mishandles persistent connections. But its breakage is manifesting in a way that is permitted by the standard. So if it affects other code, that code is broken too. :)

Thanks.


Well, in that case, PHP is broken. :P

I think I'll be adding in your patch and recompiling the code.