Closed neotyk closed 13 years ago
I managed to reproduce it in local environment.
Setup is as follows: Nginx serving big files. Asynchronous HTTP Client talking to Nginx via proxy, requesting 10 files in paralel.
Result: "Something's amiss" in logs, and not all content received.
Many apologies for the delay addressing this. I've seen this a few times in the logs as well. I think it might be since I updated to the latest Netty. I'm getting pulled in a million different directions right now, but you might try reverting to the prior Netty and seeing if that fixes it.
You're able to consistently reproduce it, and it definitely causes errors? I haven't actually seen that issue cause errors directly, but I've been focused on things built on LittleProxy and not LittleProxy itself for a little while now.
Affects me too.
Are you guys using 0.3 or the 0.4-SNAPSHOT? I apologize for neglecting LittleProxy these last few months -- super tied up with Lantern, an upcoming censorship circumvention tool that also uses LittleProxy.
I have not been seeing this issue, but I've also started deploying snapshots to nexus. Try this maven config:
<dependency>
<groupId>org.littleshoot</groupId>
<artifactId>littleproxy</artifactId>
<version>0.4-SNAPSHOT</version>
</dependency>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
I am using 0.4-SNAPSHOT with your maven config and I am seeing this error when visiting for example http://www.sme.sk/.
I probably found the issue. In the HttpRequestHandler.channelClosed the call future.getChannel().close() causes call to HttpRequestHandler.onRelayChannelClose. In HttpRequestHandler.channelClosed the numWebConnections is zeroed but HttpRequestHandler.onRelayChannelClose is called for every closed channel again and thus numWebConnections is decreased (often below zero). Another sympthom is that endpointsToChannelFutures.remove(key) returns null in HttpRequestHandler.onRelayChannelClose.
Solution is to delete following lines from HttpRequestHandler.channelClosed: endpointsToChannelFutures.clear(); numWebConnections = 0;
I am beginner with netty so I may be wrong ;-).
Another great catch Martin -- thanks. I just committed and deployed this fix as well. Can you guys verify that you no longer see the issue?
I should also note I don't think this should have any functional effect. I only added that code to make sure the logic was generally correct and that connections weren't getting out of sync, but the tracking logic itself was wrong.
Thanks again Martin. I'm stretched thin on my end, so this is really a big help.
Closing this as it appears to be fixed on master.
In logs I found following:
What made me worried is last line: "We have -1 and 0 conn...". Apparently this should not happen. I've tried fixing it in our clone: https://github.com/sourcesense/LittleProxy Though we still see this error.
Please help in fixing it.