You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexey Varlamov (JIRA)" <ji...@apache.org> on 2006/09/21 12:13:22 UTC

[jira] Created: (HARMONY-1519) [DRLVM] Performance degradation while working in Eclipse

[DRLVM] Performance degradation while working in Eclipse 
---------------------------------------------------------

                 Key: HARMONY-1519
                 URL: http://issues.apache.org/jira/browse/HARMONY-1519
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
         Environment: 2xXeon CPU, Windows 2003 Server SP1
            Reporter: Alexey Varlamov
            Priority: Critical


The DRLVM sometimes become VERY slow during Eclipse session, it almost freezes whole system consuming 99% CPU.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1519) [DRLVM] Performance degradation while working in Eclipse

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1519?page=comments#action_12436490 ] 
            
Alexey Varlamov commented on HARMONY-1519:
------------------------------------------

I found endless loops sporadically occur in the patched APR function _thread_cond_timedwait(). 

Typical backtrace is:
--------------------------------------------------------------------------------
  ntdll.dll!7c82ed54()  
  ntdll.dll!7c822124()  
  kernel32.dll!77e6baa8()  
  ntdll.dll!7c82f9dd()  
  kernel32.dll!77e6ba12()  
> hythr.dll!_thread_cond_timedwait(apr_thread_cond_t * cond=0x00828140, apr_thread_mutex_t * mutex=0x00828108, unsigned long timeout_ms=0xffffffff)  Line 63 + 0x11 C
  hythr.dll!apr_thread_cond_wait(apr_thread_cond_t * cond=0x00828140, apr_thread_mutex_t * mutex=0x00828108)  Line 105 + 0xf C
  hythr.dll!condvar_wait_impl(HyCond * cond=0x00828140, HyMutex * mutex=0x00828108, __int64 ms=0x0000000000000000, int nano=0x00000000, int interruptable=0x00000000)  Line 70 + 0x25 C
  hythr.dll!sem_wait_impl(HySemaphore * sem=0x008280f0, __int64 ms=0x0000000000000000, int nano=0x00000000, int interruptable=0x00000000)  Line 68 + 0x19 C
  hythr.dll!hysem_wait(HySemaphore * sem=0x008280f0)  Line 106 + 0x12 C
  gc.dll!gc_thread_func(void * arg=0x0536ec60)  Line 209 C++
  hythr.dll!thread_start_proc(apr_thread_t * thd=0x0082bea8, void * p_args=0x0082be10)  Line 707 C
  hythr.dll!dummy_worker(void * opaque=0x0082bea8)  Line 80 C
  hythr.dll!_threadstartex(void * ptd=0x003a1f28)  Line 241 + 0x6 C
  kernel32.dll!77e66063()  
--------------------------------------------------------------------------------

For the selected frame, locals are:
--------------------------------------------------------------------------------
- cond 0x00828140 {...} apr_thread_cond_t *
+ pool 0x00827dc8 {...} apr_pool_t *
 event 0x00000734 void *
 signal_all 0x00000000 int
 num_waiting 0x00000001 int
 signalled 0x00000001 int
 wait_level 0x0000001b unsigned int
 notify_level 0x0000001a unsigned int
 cond->event 0x00000734 void *
+ mutex 0x00828108 {...} apr_thread_mutex_t *
 res 0x00000000 unsigned long
 timeout_ms 0xffffffff unsigned long
--------------------------------------------------------------------------------

The code of the loop is:
--------------------------------------------------------------------------------
while (1) {
    cond->num_waiting++;
    apr_thread_mutex_unlock(mutex);
    res = WaitForSingleObject(cond->event, timeout_ms);
    apr_thread_mutex_lock(mutex);
    cond->num_waiting--;

    if (res != WAIT_OBJECT_0) {
        apr_status_t rv = apr_get_os_error();
        if (res == WAIT_TIMEOUT) {
            return APR_TIMEUP;
        }

        return apr_get_os_error();
    }

    if (cond->signal_all) {
                [snip]
    }
    else if (cond->signalled && NOT_STALED(this_wait_level, cond->notify_level)) {
        cond->signalled = 0;
        ResetEvent(cond->event);
        break;
    }
}
--------------------------------------------------------------------------------

Interpretation is the following:
Somehow the thread condition become STALE (i.e. wait_level  > notify_level ), and after the event is signalled, there is no way out of the loop but the event is not reset. So it just wastes CPU cycles calling WaitForSingleObject on signalled event.

> [DRLVM] Performance degradation while working in Eclipse
> --------------------------------------------------------
>
>                 Key: HARMONY-1519
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1519
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: 2xXeon CPU, Windows 2003 Server SP1
>            Reporter: Alexey Varlamov
>            Priority: Critical
>
> The DRLVM sometimes become VERY slow during Eclipse session, it almost freezes whole system consuming 99% CPU.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1519) [DRLVM] Performance degradation while working in Eclipse

Posted by "Artem Aliev (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1519?page=comments#action_12439402 ] 
            
Artem Aliev commented on HARMONY-1519:
--------------------------------------

> I'm assuming only the new patch needs to be applied... 

Right



> [DRLVM] Performance degradation while working in Eclipse
> --------------------------------------------------------
>
>                 Key: HARMONY-1519
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1519
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: 2xXeon CPU, Windows 2003 Server SP1
>            Reporter: Alexey Varlamov
>         Assigned To: Geir Magnusson Jr
>            Priority: Critical
>         Attachments: apr_cond.patch, new_queued_cond_var.patch
>
>
> The DRLVM sometimes become VERY slow during Eclipse session, it almost freezes whole system consuming 99% CPU.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-1519) [DRLVM] Performance degradation while working in Eclipse

Posted by "Artem Aliev (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1519?page=all ]

Artem Aliev updated HARMONY-1519:
---------------------------------

    Attachment: queued_cond_var2.patch

Alexey, You comments were addressed in the queued_cond_var2.patch. 
Geir, please apply only the  queued_cond_var2.patch.
Thanks.
Artem


> [DRLVM] Performance degradation while working in Eclipse
> --------------------------------------------------------
>
>                 Key: HARMONY-1519
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1519
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: 2xXeon CPU, Windows 2003 Server SP1
>            Reporter: Alexey Varlamov
>         Assigned To: Geir Magnusson Jr
>            Priority: Critical
>         Attachments: apr_cond.patch, new_queued_cond_var.patch, queued_cond_var2.patch
>
>
> The DRLVM sometimes become VERY slow during Eclipse session, it almost freezes whole system consuming 99% CPU.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1519) [DRLVM] Performance degradation while working in Eclipse

Posted by "Geir Magnusson Jr (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1519?page=comments#action_12438811 ] 
            
Geir Magnusson Jr commented on HARMONY-1519:
--------------------------------------------

I'm assuming only the new patch needs to be applied...

> [DRLVM] Performance degradation while working in Eclipse
> --------------------------------------------------------
>
>                 Key: HARMONY-1519
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1519
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: 2xXeon CPU, Windows 2003 Server SP1
>            Reporter: Alexey Varlamov
>         Assigned To: Geir Magnusson Jr
>            Priority: Critical
>         Attachments: apr_cond.patch, new_queued_cond_var.patch
>
>
> The DRLVM sometimes become VERY slow during Eclipse session, it almost freezes whole system consuming 99% CPU.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1519) [DRLVM] Performance degradation while working in Eclipse

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1519?page=comments#action_12439391 ] 
            
Alexey Varlamov commented on HARMONY-1519:
------------------------------------------

Yes, exactly. 
I'll try to ping Artem for reply on my comments.

> [DRLVM] Performance degradation while working in Eclipse
> --------------------------------------------------------
>
>                 Key: HARMONY-1519
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1519
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: 2xXeon CPU, Windows 2003 Server SP1
>            Reporter: Alexey Varlamov
>         Assigned To: Geir Magnusson Jr
>            Priority: Critical
>         Attachments: apr_cond.patch, new_queued_cond_var.patch
>
>
> The DRLVM sometimes become VERY slow during Eclipse session, it almost freezes whole system consuming 99% CPU.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (HARMONY-1519) [DRLVM] Performance degradation while working in Eclipse

Posted by "Geir Magnusson Jr (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1519?page=all ]

Geir Magnusson Jr resolved HARMONY-1519.
----------------------------------------

    Resolution: Fixed

r452912

Tested on linux - smoke, c-unit, ~kernel

Testing on windows XP now


> [DRLVM] Performance degradation while working in Eclipse
> --------------------------------------------------------
>
>                 Key: HARMONY-1519
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1519
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: 2xXeon CPU, Windows 2003 Server SP1
>            Reporter: Alexey Varlamov
>         Assigned To: Geir Magnusson Jr
>            Priority: Critical
>         Attachments: apr_cond.patch, new_queued_cond_var.patch, queued_cond_var2.patch
>
>
> The DRLVM sometimes become VERY slow during Eclipse session, it almost freezes whole system consuming 99% CPU.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1519) [DRLVM] Performance degradation while working in Eclipse

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1519?page=comments#action_12437748 ] 
            
Alexey Varlamov commented on HARMONY-1519:
------------------------------------------

Artem, I like the new patch; it does not look like workaround anymore ;)
Just minor comments, in the function _thread_cond_timedwait():

85: unused variable struct waiting_node *tmp;

95-103:    Getting apr_get_os_error() is a bit late, error status is likely to be reset after apr_thread_mutex_lock() .

    res = WaitForSingleObject(node.event, timeout_ms);
    apr_thread_mutex_lock(mutex);
       if (res != WAIT_OBJECT_0) {
            if (res == WAIT_TIMEOUT) {
                rv = APR_TIMEUP;
            } else {
               rv = apr_get_os_error();
            }
        }

104 - 107:     CloseHandle() better be called after UNLOCK_QUEUE
    LOCK_QUEUE;
    _remove_from_queue (cond, &node);
    CloseHandle(node.event);
    UNLOCK_QUEUE;

> [DRLVM] Performance degradation while working in Eclipse
> --------------------------------------------------------
>
>                 Key: HARMONY-1519
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1519
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: 2xXeon CPU, Windows 2003 Server SP1
>            Reporter: Alexey Varlamov
>            Priority: Critical
>         Attachments: apr_cond.patch, new_queued_cond_var.patch
>
>
> The DRLVM sometimes become VERY slow during Eclipse session, it almost freezes whole system consuming 99% CPU.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (HARMONY-1519) [DRLVM] Performance degradation while working in Eclipse

Posted by "Geir Magnusson Jr (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1519?page=all ]

Geir Magnusson Jr reassigned HARMONY-1519:
------------------------------------------

    Assignee: Geir Magnusson Jr

> [DRLVM] Performance degradation while working in Eclipse
> --------------------------------------------------------
>
>                 Key: HARMONY-1519
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1519
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: 2xXeon CPU, Windows 2003 Server SP1
>            Reporter: Alexey Varlamov
>         Assigned To: Geir Magnusson Jr
>            Priority: Critical
>         Attachments: apr_cond.patch, new_queued_cond_var.patch
>
>
> The DRLVM sometimes become VERY slow during Eclipse session, it almost freezes whole system consuming 99% CPU.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-1519) [DRLVM] Performance degradation while working in Eclipse

Posted by "Artem Aliev (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1519?page=all ]

Artem Aliev updated HARMONY-1519:
---------------------------------

    Attachment: apr_cond.patch

Attach patch for this problem.
We reset the event only when all waiter is notified. 

> [DRLVM] Performance degradation while working in Eclipse
> --------------------------------------------------------
>
>                 Key: HARMONY-1519
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1519
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: 2xXeon CPU, Windows 2003 Server SP1
>            Reporter: Alexey Varlamov
>            Priority: Critical
>         Attachments: apr_cond.patch
>
>
> The DRLVM sometimes become VERY slow during Eclipse session, it almost freezes whole system consuming 99% CPU.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-1519) [DRLVM] Performance degradation while working in Eclipse

Posted by "Artem Aliev (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1519?page=all ]

Artem Aliev updated HARMONY-1519:
---------------------------------

    Attachment: new_queued_cond_var.patch

The previous patch improve situation, but does not fully solve cond_var compatibility problem. Thus Object.wait() still works incorrectly on windows.
See the http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
The current patch is a variant of " 3.3. The Generation Count Solution"
The article also mentioned complicated "3.4. The SignalObjectAndWait Solution"
But it also has problems. See: 
http://sourceware.org/ml/pthreads-win32/2001/msg00012.html

To improve the condition variables, I select the algorithm used in java.util.concurrent (JSR-166) because of it simplicity. 
See http://gee.cs.oswego.edu/dl/papers/aqs.pdf
"3.4 Condition Queues"

New patch attached


> [DRLVM] Performance degradation while working in Eclipse
> --------------------------------------------------------
>
>                 Key: HARMONY-1519
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1519
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: 2xXeon CPU, Windows 2003 Server SP1
>            Reporter: Alexey Varlamov
>            Priority: Critical
>         Attachments: apr_cond.patch, new_queued_cond_var.patch
>
>
> The DRLVM sometimes become VERY slow during Eclipse session, it almost freezes whole system consuming 99% CPU.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1519) [DRLVM] Performance degradation while working in Eclipse

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1519?page=comments#action_12436491 ] 
            
Alexey Varlamov commented on HARMONY-1519:
------------------------------------------

Suggested workaround is to uncoditionally reset the event after each interruption. 
What Windows gurus can say?

> [DRLVM] Performance degradation while working in Eclipse
> --------------------------------------------------------
>
>                 Key: HARMONY-1519
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1519
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: 2xXeon CPU, Windows 2003 Server SP1
>            Reporter: Alexey Varlamov
>            Priority: Critical
>
> The DRLVM sometimes become VERY slow during Eclipse session, it almost freezes whole system consuming 99% CPU.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (HARMONY-1519) [DRLVM] Performance degradation while working in Eclipse

Posted by "Geir Magnusson Jr (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1519?page=all ]

Geir Magnusson Jr closed HARMONY-1519.
--------------------------------------


Well, this worked in WinXP too - usual hang on gc.LOS - we really need to fix that

> [DRLVM] Performance degradation while working in Eclipse
> --------------------------------------------------------
>
>                 Key: HARMONY-1519
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1519
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: 2xXeon CPU, Windows 2003 Server SP1
>            Reporter: Alexey Varlamov
>         Assigned To: Geir Magnusson Jr
>            Priority: Critical
>         Attachments: apr_cond.patch, new_queued_cond_var.patch, queued_cond_var2.patch
>
>
> The DRLVM sometimes become VERY slow during Eclipse session, it almost freezes whole system consuming 99% CPU.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira