You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@apr.apache.org by bu...@apache.org on 2008/06/27 14:56:09 UTC

DO NOT REPLY [Bug 45298] New: apr_os_thread_get() differs between windows and unix when thread is detached

https://issues.apache.org/bugzilla/show_bug.cgi?id=45298

           Summary: apr_os_thread_get() differs between windows and unix
                    when thread is detached
           Product: APR
           Version: HEAD
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: APR
        AssignedTo: bugs@apr.apache.org
        ReportedBy: Joe.Mudd@sas.com


On Windows when a thread is created detached or apr_thread_detach() is called,
the apr_thread_t->td member gets set to NULL.  Therefore, when
apr_os_thread_get() is called, NULL is returned.

This differs from the UNIX implementation which always returns the pthread_t *
even if the thread is detached.

Also, similar to Bug 42728, it appears to be possible for apr_os_thread_get()
to be called in the created thread before apr_thread_create() in the creating
thread has had a chance to set thd->td.

Perhaps threads on Windows should be created with CREATE_SUSPENDED flag and
ResumeThread() should be called once thd->td has been set.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 45298] apr_os_thread_get() differs between windows and unix when thread is detached

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45298

Lars Diehl <la...@fiducia.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lars.diehl@fiducia.de

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 45298] apr_os_thread_get() differs between windows and unix when thread is detached

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45298

Lars Diehl <la...@fiducia.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #31269|0                           |1
        is obsolete|                            |

--- Comment #11 from Lars Diehl <la...@fiducia.de> ---
Created attachment 31270
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31270&action=edit
Proposed Fix based on 1.4.8

I apologize - the proposal is based on APR Version 1.4.8 (which is the current
version we are using). So far I was unable to build any 1.5.X or trunk versions
on windows due to compilation errors.

The proposal contains two changes:

1. Start threads suspended in order to work around the race-condition when
saving the thread handle in apr_thread_create().

2. Use GetCurrentThread() API in apr_os_thread_current(). I'm not sure why in
the current implementation the handle is duplicated. Maybe I missed something
here.

Fix: Added CREATE_SUSPENDED for the Windows-CE version.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 45298] apr_os_thread_get() differs between windows and unix when thread is detached

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45298

--- Comment #8 from Lars Diehl <la...@fiducia.de> ---
ok - understand. 

I prepared a set of changes before I found this record. IMHO the issue could be
solved simpler. 

Would it make it easier to post my proposal here?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 45298] apr_os_thread_get() differs between windows and unix when thread is detached

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45298

--- Comment #7 from Jeff Trawick <tr...@apache.org> ---
>Joe provided a patch for this issue 5 years ago. Is somebody taking care of these requests?
My guess at the cause of the lack of responsiveness:  When devs have looked at
the patch they have the initial impression that it is way too complicated to be
the right fix (not necessarily a correct assessment), and that combined with
the fact that only a subset of devs work on the Windows code aside from very
minor changes has resulted in the proposed patch not being evaluated all this
time.

I'll give it a hard look before the next apr 1.5.x release.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 45298] apr_os_thread_get() differs between windows and unix when thread is detached

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45298

--- Comment #6 from Lars Diehl <la...@fiducia.de> ---
This issue still seems unresolved in the current APR version. When detached
threads are used in windows the apr_os_thread_current() causes a handle leak
for each thread created. For me it is not clear why the thread handle that
apr_os_thread_current() returns is duplicated inside the function. 

The race condition in apr_thread_create() can cause handle leaks for
non-detached threads.

For us a fix for this issue is critical. We are facing handle leaks in our
code. In case we cannot get this fixed in APR we need to replace
apr_os_thread_current() and observe the race condition the threading 

Joe provided a patch for this issue 5 years ago. Is somebody taking care of
these requests?

This issue seems to be a duplicate of bug 42728.

What would be the preferred way to get this fixed in APR trunk, 1.5 and 1.4?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 45298] apr_os_thread_get() differs between windows and unix when thread is detached

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45298

--- Comment #9 from Jeff Trawick <tr...@apache.org> ---
>Would it make it easier to post my proposal here?
Yes, please provide your proposal.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


DO NOT REPLY [Bug 45298] apr_os_thread_get() differs between windows and unix when thread is detached

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45298





--- Comment #5 from Joe Mudd <Jo...@sas.com>  2008-09-05 05:58:45 PST ---
This bug hasn't seen any activity.  Did I fail to follow the proper bug
reporting procedures?  Please let me know or point me in to the proper
documentation to ensure this bug is addressed.  Thanks.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


DO NOT REPLY [Bug 45298] apr_os_thread_get() differs between windows and unix when thread is detached

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45298


Joe Mudd <Jo...@sas.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|HEAD                        |1.3.0




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 45298] apr_os_thread_get() differs between windows and unix when thread is detached

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45298

--- Comment #10 from Lars Diehl <la...@fiducia.de> ---
Created attachment 31269
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31269&action=edit
Proposed fix based on 1.4.8

I apologize - the proposal is based on APR Version 1.4.8 (which is the current
version we are using). So far I was unable to build any 1.5.X or trunk versions
on windows due to compilation errors.

The proposal contains two changes:

1. Start threads suspended in order to work around the race-condition when
saving the thread handle in apr_thread_create().

2. Use GetCurrentThread() API in apr_os_thread_current(). I'm not sure why in
the current implementation the handle is duplicated. Maybe I missed something
here.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 45298] apr_os_thread_get() differs between windows and unix when thread is detached

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45298

Lars Diehl <la...@fiducia.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


DO NOT REPLY [Bug 45298] apr_os_thread_get() differs between windows and unix when thread is detached

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45298





--- Comment #3 from Joe Mudd <Jo...@sas.com>  2008-06-27 13:52:01 PST ---
I have added a patch that may do the trick for this bug and Bug 42728.

Well, assuming that callers are expected to call apr_thread_exit() and when the
thread is not detached, apr_thread_join().


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


DO NOT REPLY [Bug 45298] apr_os_thread_get() differs between windows and unix when thread is detached

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45298





--- Comment #2 from Joe Mudd <Jo...@sas.com>  2008-06-27 13:50:21 PST ---
Created an attachment (id=22191)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22191)
apr_arch_threadproc.h

Proposed fix


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


DO NOT REPLY [Bug 45298] apr_os_thread_get() differs between windows and unix when thread is detached

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45298





--- Comment #1 from Joe Mudd <Jo...@sas.com>  2008-06-27 13:49:45 PST ---
Created an attachment (id=22190)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22190)
thread.c updates

Proposed fix


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


DO NOT REPLY [Bug 45298] apr_os_thread_get() differs between windows and unix when thread is detached

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45298





--- Comment #4 from Joe Mudd <Jo...@sas.com>  2008-06-30 08:25:58 PST ---
The patch should also address Bug 45291.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org