This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 208711 - Internal websocket server eats 100% CPU
Summary: Internal websocket server eats 100% CPU
Status: RESOLVED FIXED
Alias: None
Product: ide
Classification: Unclassified
Component: Extbrowser (show other bugs)
Version: 7.2
Hardware: PC Mac OS X
: P2 normal (vote)
Assignee: Denis Anisimov
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2012-02-21 17:54 UTC by Petr Jiricka
Modified: 2012-09-03 12:54 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Profiler snapshot (7.37 KB, application/octet-stream)
2012-02-21 17:54 UTC, Petr Jiricka
Details
Screenshot of the snapshot (283.25 KB, image/png)
2012-02-21 17:54 UTC, Petr Jiricka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Jiricka 2012-02-21 17:54:07 UTC
Created attachment 115991 [details]
Profiler snapshot

Build from the Easel branch - after connecting the browser to the IDE, the embedded websocket server eats 100% of CPU - see the attached profiler snapshot.
Comment 1 Petr Jiricka 2012-02-21 17:54:35 UTC
Created attachment 115992 [details]
Screenshot of the snapshot
Comment 2 Denis Anisimov 2012-02-21 18:17:53 UTC
Why do you think the problem is websocket server ?
I see two GF logview processes that also eat processor.
Socket server spend time inside of JDK (NIO) calls :
Selector.select()
SocketChanel.read()
Both methods has no relation to WS server implementation logic. They are mapped 
into native OS network calls.
At the same time mentioned GF calls are InputStream read() 
methods which are blocking IO operations.

So it seems this is combination of some network influence issue with main 
blocking IO operation in GF code.

Are there exact steps to reproduce ?
Comment 3 Denis Anisimov 2012-02-21 18:52:02 UTC
OK, it seems I got it.
The CPU is occupied because of "while" cycle in the main server code.
Socket channel is requested to close in the cycle but it's not closed and 
as result it is not removed from available keys.
So the cycle works infinitely without sleep.
Comment 4 Denis Anisimov 2012-02-22 07:01:28 UTC
web-main#c07cce1921a1
Comment 5 Quality Engineering 2012-09-03 12:54:21 UTC
Integrated into 'main-golden', will be available in build *201209031048* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/c07cce1921a1
User: Denis Anisimov <ads@netbeans.org>
Log: Fix for BZ#208711 - Internal websocket server eats 100% CPU