huuanh1987 / facebook-java-api

Automatically exported from code.google.com/p/facebook-java-api
0 stars 0 forks source link

Socket Connection Leak #246

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Version 2.1.1.

The current implementation of the ExtensibleClient relies on Java's Socket
library for performing posts and file uploads. The problem with Java's
socket implementation is that when connections are released, the Java
framework relies on the underlying OS to cleanup the socket. We have
experienced issues where the number of socket connections created are such
that the OS cannot release these resources fast enough.

A better solution would be to use socket connection pooling. Apache's
HttpClient (http://hc.apache.org/httpclient-3.x/) supports connection pooling. 

I have provided a patch that externalizes the network code from the
ExtensibleClient into a CommunicationBridge instance. I moved the existing
network implementation into DefaultCommunicationBridge which is used in the
event that the client is initialized without specifying a
CommunicationBridge instance. This code can be found in the attached
socket_fix.zip file.

I have also provided an implementation of CommunicationBridge that uses
HttpClient. To not introduce a dependency to HttpClient, I have included it
as a separate file attachment that you can include if you feel like adding
the dependency. The file is HttpClientCommunicationBridge.java.

-Kyle

Original issue reported on code.google.com by klom...@gmail.com on 23 Sep 2009 at 3:38

Attachments:

GoogleCodeExporter commented 8 years ago
There is a bug in the file I provided previously. Here is the fixed 
implementation.

Original comment by klom...@gmail.com on 23 Sep 2009 at 9:07

Attachments:

GoogleCodeExporter commented 8 years ago
Hey, guys. I am planning on working on the new dashboard API and I have an 
in-house 
implementation of the Banned-users API. I work alongside Jasper Rosenberg. 
Could 
anyone give me commit permission to the project? I'd love to merge what I 
already have 
and the Dashboard API once it is done.

Original comment by klom...@gmail.com on 27 Jan 2010 at 8:02

GoogleCodeExporter commented 8 years ago
could you please share your dashboard implementation with us once you have sth 
done?

thanx

Original comment by mckrue...@gmx.de on 31 Jan 2010 at 9:33

GoogleCodeExporter commented 8 years ago
I have committed this patch to allow plugging in different http communication 
bridges.

Original comment by jasper.r...@gmail.com on 16 Feb 2010 at 3:12