[ 
https://issues.apache.org/jira/browse/AXIS2C-1411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Lazarski resolved AXIS2C-1411.
-------------------------------------
    Fix Version/s: 2.0.0
       Resolution: Information Provided

Closing as "Info Provided" with documentation clarification in 
util/include/axutil_thread.h:                                      
                                                                                
              
  1. Fundamental design issue: The axutil_thread_exit() function has an 
inherently flawed     
  contract - safe external thread termination is problematic on both Unix and 
Windows:        
    - Unix: No safe way to forcefully terminate another thread                  
              
    - Windows: TerminateThread() is explicitly warned against by Microsoft (no 
cleanup, no    
  stack unwinding)                                                              
              
  2. The patch doesn't fix the underlying problem: Using pthread_cancel() 
shifts the burden to
   all thread functions needing to be cancellation-safe.                        
              
  3. Proper pattern: Thread termination should be cooperative - threads should 
check a flag   
  and exit gracefully. The existing try_exit flag mechanism was an attempt at 
this but was    
  implemented incorrectly.                                                      
              
  4. Age and risk: Changing 16-year-old threading code risks introducing subtle 
bugs for      
  minimal practical benefit.  

> thread_unix and thread_windows inconsistency as for axutil_thread_exit
> ----------------------------------------------------------------------
>
>                 Key: AXIS2C-1411
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-1411
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: util
>         Environment: Unix
>            Reporter: Francois Mireaux
>            Priority: Major
>              Labels: patch
>             Fix For: 2.0.0
>
>         Attachments: util.patch
>
>
> In thread_unix.c, axutil_thread_exit :
>       - sleep until thread is detached (try_exit is only set to true by 
> axutil_thread_detach)
>       - call pthread_kill with 0 as second parameter which has no effect on 
> thread (only test possible errors)
>       - call axutil_thread_join which doesn't work on detached thread but 
> return code isn't tested
> In thread_windows.c, axutil_thread_exit  simply call TerminateThread which 
> kills the thread (not cleany by the way) before calling axutil_thread_join 
> (try_exit is not used).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to