Bug 173893 - AbstractResponse.openStreamWithCanel pegs CPU
Summary: AbstractResponse.openStreamWithCanel pegs CPU
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Update (deprecated - use Eclipse>Equinox>p2) (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M6   Edit
Assignee: Branko Tripkovic CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-02-12 12:45 EST by Chris Grindstaff CLA
Modified: 2007-04-10 17:40 EDT (History)
7 users (show)

See Also:


Attachments
Patch to fix problem (858 bytes, patch)
2007-02-12 12:47 EST, Chris Grindstaff CLA
no flags Details | Diff
Fixes another problem (1.08 KB, patch)
2007-02-15 16:58 EST, Chris Grindstaff CLA
no flags Details | Diff
Modified patch to fix additional problems (3.90 KB, patch)
2007-02-19 14:07 EST, James D. Miles CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Grindstaff CLA 2007-02-12 12:45:10 EST
Build ID: I20070210-0800

Steps To Reproduce:
1. Add a new remote site
2. Add a breakpoint in ConnectionThreadManager line 96
3. Click finish


More information:
AbstractResponse.openStreamWithCancel will peg the CPU when the runnable getInputStream is slow to return.
Comment 1 Chris Grindstaff CLA 2007-02-12 12:47:45 EST
Created attachment 58787 [details]
Patch to fix problem

The fix is to move the join inside the for(::) loop.
I've attached a patch.
Comment 2 Chris Grindstaff CLA 2007-02-15 16:58:22 EST
Created attachment 59102 [details]
Fixes another problem

There are 2 problems
1) A background thread would busy spin while it waited for another thread to connect. If the connector thread takes a long time, the CPU is pegged.

2) The second problem is a race-condition associated with the 2 threads. If the connection is established (or fails) quickly the polling thread may loop forever, again pegging the CPU.

This is fixed now.
Comment 3 Chris Aniszczyk CLA 2007-02-16 10:48:40 EST
Dejan, this one is biting us pretty bad, what are your thoughts?
Comment 4 Dejan Glozic CLA 2007-02-16 10:58:38 EST
Branko, please review the patch and release into HEAD. 
Comment 5 Chris Aniszczyk CLA 2007-02-16 11:03:40 EST
Thanks for the quick attention Dejan. This will have to be added to the beer tab.
Comment 6 James D. Miles CLA 2007-02-19 14:07:51 EST
Created attachment 59298 [details]
Modified patch to fix additional problems

These changes preserve exception messages.
They also fix disconnect behavior
Comment 7 Dejan Glozic CLA 2007-03-21 17:25:21 EDT
This is a localized patch - safe to backport to the maintenance stream if you want.

I released it into M6 - keep an eye on connection issues before backporting.