bugGNU Octave - Bugs: bug #64708, mxFree causes crash inside OMP...

 
 

bug #64708: mxFree causes crash inside OMP parallel block

Submitter:  None
Submitted:  Fri 22 Sep 2023 06:31:39 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  None Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * 8.3.0
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 23 Sep 2023 07:06:32 AM UTC, comment #2: 

Gee I'm glad I took the time to file a separate bug report, as you requested. You're right - nobody's noticed the bug for 5+ years anyway. No worries.

Anonymous
Fri 22 Sep 2023 07:30:08 PM UTC, comment #1: 

There are a number of statements on the web, including in the Matlab online documentations and help archives that state that the mex functions are not thread safe.  So maybe you just get lucky that they work for you in multi-threaded code?

John W. Eaton <jwe>
Group administrator
Fri 22 Sep 2023 06:31:39 PM UTC, original submission:  

mxMalloc/mxFree cause a crash when used inside an OMP parallel block. Replacing them with malloc/free works so it must be something to do with mex_context, which I'm afraid goes above my pay grade to comprehend.

mxFree (void *ptr)
{

  if (mex_context)

    mex_context->free (ptr);

  else

    xfree (ptr);

}



I'm attaching a short demo code (TestFunc.cpp) and the output from compiling and running it in Octave.


octave:1> mex TestFunc.cpp -fopenmp
octave:2> TestFunc(1)
1
octave:3> TestFunc(0)
fatal: caught signal fatal: caught signal fatal: caught signal fatal: caught signal fatal: caught signal fatal: caught signal fatal: caught signal fatal: caught signal Segmentation faultSegmentation fault -- stopping myself...Segmentation fault -- stopping myself...
Segmentation faultfatal: caught signal Segmentation faultSegmentation fault -- stopping myself...

 -- stopping myself...
Segmentation fault (core dumped)


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #55157:  TestFunc.cpp added by None (550B - text/x-c++src)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-09-22 None Attached File- Added TestFunc.cpp, #55157

    Back to the top

    Powered by Savane 3.12