sfs2x.connect leaking fds ?

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

Satyarth
Posts: 131
Joined: 06 Nov 2008, 12:45
Location: Delhi, India
Contact:

sfs2x.connect leaking fds ?

Postby Satyarth » 20 Jun 2013, 01:04

Hello All,

Is there any known issue with connect(ip,port) method call in SmartFox class in SFS2X ? I noticed that it is leaking file descriptors. This is what i m doing :

sfsClient = new sfs2x.client.SmartFox();
sfsClient.connect(playerSessionData.getRoomInfo().getIP(), playerSessionData.getRoomInfo().getPort());

I uncommented all handlers, so we are not even listening for CONNECTION event. So there is no code flow kicking in after sfsClient.connect(..). But we still see lot of open files all of a sudden. And these open files are pipes. If i comment our sfsClient.connect(..) call then my app's fd count stays good.

The app we are creating is a load test tool and will launch several SmartFox clients on same machine.
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: sfs2x.connect leaking fds ?

Postby Lapo » 20 Jun 2013, 09:12

I moved this under the proper section (Java API)

No, there is no know problem with the Java API. Just make sure to use the latest version available (1.2.0)
By file descriptor what resource are you referring to exactly? Open files? Open sockets? Threads?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
Satyarth
Posts: 131
Joined: 06 Nov 2008, 12:45
Location: Delhi, India
Contact:

Re: sfs2x.connect leaking fds ?

Postby Satyarth » 20 Jun 2013, 16:14

The open fds correspond to pipes. So 2 fds for each pipe
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: sfs2x.connect leaking fds ?

Postby Lapo » 20 Jun 2013, 17:20

What is a pipe?
Open files? Open sockets? Threads?
Lapo

--

gotoAndPlay()

...addicted to flash games
Satyarth
Posts: 131
Joined: 06 Nov 2008, 12:45
Location: Delhi, India
Contact:

Re: sfs2x.connect leaking fds ?

Postby Satyarth » 20 Jun 2013, 17:59

This is what i see when i run lsof -np PID. I see hundreds of similar entries.


java 27687 root 185r FIFO 0,6 0t0 16702578 pipe
java 27687 root 186w FIFO 0,6 0t0 16702578 pipe
java 27687 root 187u 0000 0,7 0 393 anon_inode
java 27687 root 188r FIFO 0,6 0t0 16702579 pipe
java 27687 root 189w FIFO 0,6 0t0 16702579 pipe
java 27687 root 190u 0000 0,7 0 393 anon_inode
java 27687 root 191r FIFO 0,6 0t0 16702580 pipe
java 27687 root 192w FIFO 0,6 0t0 16702580 pipe
java 27687 root 193u 0000 0,7 0 393 anon_inode
java 27687 root 194r FIFO 0,6 0t0 16702581 pipe
java 27687 root 195w FIFO 0,6 0t0 16702581 pipe
java 27687 root 196u 0000 0,7 0 393 anon_inode
java 27687 root 197r FIFO 0,6 0t0 16702582 pipe
java 27687 root 198w FIFO 0,6 0t0 16702582 pipe
java 27687 root 199u 0000 0,7 0 393 anon_inode
java 27687 root 200r FIFO 0,6 0t0 16702583 pipe
java 27687 root 201w FIFO 0,6 0t0 16702583 pipe
java 27687 root 202u 0000 0,7 0 393 anon_inode
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: sfs2x.connect leaking fds ?

Postby Lapo » 20 Jun 2013, 19:19

hundreds for a single instance of the client?
can you please be more detailed? thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
Satyarth
Posts: 131
Joined: 06 Nov 2008, 12:45
Location: Delhi, India
Contact:

Re: sfs2x.connect leaking fds ?

Postby Satyarth » 20 Jun 2013, 19:26

So i am writing a load test tool and i want to be able to have this load test tool create several bots where each bot will have its own SmartFox client connected instance.
My problem is that when my load test tool even creates a single bot with one SmartFox connect i see an increase of 50 file descriptors open by process.

I wrote a simple program where all i do is just do SmartFox connect call ( no event listeners etc ). As soon as connect call is done, there is an increase in file descriptors used by process by 40-50. And all i see are these pipes as i sent above. I see one socket too, which is fine and expected. But my concern is these pipes. As using so many file descriptors is limiting our load test tool to very little number of clients per box.
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: sfs2x.connect leaking fds ?

Postby Lapo » 21 Jun 2013, 06:03

I don't think this should be a concern.
Even if you just launch the JVM with a simple "Hello World" world program you will see "hundreds" of open files. This is because you're seeing all the files that are being loaded by the JVM process.

If I run the same command on my Skype process while it's running it lists 662 resources.

If you are assuming that if you open more connections all those resources will be duplicated then it's not correct. The JVM is already running, therefore each new connection will simply open an new socket.
If you plan to launch more than 1000 sockets on the same client you will probably need to configure your OS. See here:
http://docs2x.smartfoxserver.com/Gettin ... tall-linux
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 55 guests