mscdex / cap

A cross-platform binding for performing packet capturing with node.js
MIT License
361 stars 45 forks source link

CPU Leak #20

Closed gthgame closed 6 years ago

gthgame commented 9 years ago

Hello dear admins ,

There are an issue with CPU . if you handle with the script a big amount of packets , the cpu of the node process start to be fucked . and stay fucked . It should be back to ~ 1 / 3 % of cpu usage , but when a lot of packet come it's come back to like 30% even if no more lot of paquet come. then if receive again a lot of packet = 100% cpu . and stay at 100% even if no more packet come . If you need a test , just handle a DDoS with the node running and look how the process is working ... . It's strange because it's a cpu leak .

mscdex commented 9 years ago

Can you share the code you are using?

gthgame commented 9 years ago

Yes , can you come on my teamviewer ? i want to show you ...

gthgame commented 9 years ago

I can give you in private my code ? so you have a skype or so ?

crawfordcomeaux commented 9 years ago

You can share the code at gist.github.com.

If it's proprietary code, maybe strip out just the portions dealing with cap?

gthgame commented 9 years ago

Hum, the leak come when like 3 MPPS come per sec . The node reach 100% , but it's always keep like 25/ 30 % CPU after the network peak ... the node should hand the paquet asyn then come back to 0/1% cpu ... but sometimes it's stay 25% ...

gthgame commented 9 years ago

it's can be done by using the code example ... , need only receive on the node CAP a lot of traffic like 3mpps UDP. or so ...

mscdex commented 9 years ago

I'm not sure what to suggest other than tweaking various parameters like buffer sizes and possibly some OS-level settings. libpcap/winpcap should drop packets if the buffer for storing packets gets filled up.

gthgame commented 9 years ago

hum how can i do this ? I dont understand why when the traffic come back , after handle the paquet async , it's keep cpu loaded ... sometimes .