P-Code Generation Segmentation Fault

2 views (last 30 days)
Hello!
I am running a script to recursively generate p-code. This has been working fine up until 2012a, but now it gives a segmentation fault on a single specific file every time I try to run it for a certain application.
Is there something that I need to update along with MATLAB? What could cause this?
Thanks

Accepted Answer

Sean de Wolski
Sean de Wolski on 8 May 2012
Edited: Sean de Wolski on 14 Oct 2014

More Answers (2)

Frank Drop
Frank Drop on 14 Oct 2014
I am having exactly the same issues. I am recursively walking through a number of folders and pcode'ing their content. The first run works, the second time I run the code (within a MATLAB session) I get a segmentation error. After restarting MATLAB I can run the code once, and then I get a segmentation error again.
  1 Comment
Sean de Wolski
Sean de Wolski on 14 Oct 2014
Frank, what is the result of the following after the first run?
op = fopen('all')
If anything is open, if you
fclose all
Does the crash still happen?

Sign in to comment.


Frank Drop
Frank Drop on 15 Oct 2014
Edited: Frank Drop on 15 Oct 2014
After I run the recursive function I do op = fopen('all') which gives an empty array as result:
op =
[]
Then before rerunning I do
fclose all
But the problem persist.
I did some more tests with the function. Basic functionality is:
function recursivePCode(sourceFolder,destinationFolder)
cd(destinationFolder); % The function moves to the folder where the p code should reside.
pcode(sourceFolder); % Creates the p functions and stores it in destinationFolder
for all subfolders in destinationFolder
recursivePCode(sourceFolder/subfolder_n,destinationFolder/subfolder_n);
end
end
Now, if I run:
recursivePCode('D:\sourceFolder','D:\destinationFolder');
recursivePCode('D:\sourceFolder','D:\destinationFolder');
recursivePCode('D:\sourceFolder','D:\destinationFolder');
It will give a segmentation error during the second recursivePCode call. However, if I run...
recursivePCode('D:\sourceFolder','D:\destinationFolder1');
recursivePCode('D:\sourceFolder','D:\destinationFolder2');
recursivePCode('D:\sourceFolder','D:\destinationFolder3');
... all is fine. It seems overwriting the existing pcode is the problem. So now I attempt to delete the existing p-files in the destination folder before running pcode(), but the problem still persists.
The pcode function appears to crash on p-coding a classdef folder called '@CacheProcessData5'.
  5 Comments
Sean de Wolski
Sean de Wolski on 15 Oct 2014
If you can create a minimal working example, please send it to MathWorks Tech Support so that they can pass it along to development. Unless it's in a custom MEX file, a bug in your code should not cause a segv.
Frank Drop
Frank Drop on 16 Oct 2014
I just tried reproducing the problem, but even without deleting the files in the destination folder, the problem does not arise anymore.
I am guessing now that it (also) had something to do with the fact that the destination folder is a shared network folder (shared in the windows network) and perhaps other PCs had a lock on this folder or something like that? If the problem comes back I will post again.
Are segmentation errors more likely on old installations or perhaps sensitive to updates to the JVM? I've once ran into segmentation errors all of a sudden (no change to the matlab code) when I first ran the particular code on a certain morning (java updates are automatically installed here at work during night time). I traced this segmentation error down to a
load('somematfile.mat')
statement, which would load a variable 'd' to the function workspace, after which the function would operate on d. The segmentation error disappeared after adding
d = [];
on the line before the load statement.

Sign in to comment.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!