[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Error type 12



I was hoping Chris or Jack or someone with more Perl-specific experience 
would hop in on this one first. I don't have much Perl-specific 
experience.

>Hi!  I've created a (very large) .acgi for the place I work.  I'm having 
>a big problem with every so often, MacPerl crashes with an error type 
>12.  This then leaves the .acgi hanging, and the .acgi becomes unquitable 
>-- that is, it doesn't respond to any attempts to kill it.  If it becomes 
>foreground, and a force quit is attempted, it won't allow you to quit the 
>.acgi -- it instead pulls up some other process, and asks if you want to 
>quit that.  If you say ok, it seems to work, but about a second later the 
>whole system freezes.  I've tried using a process manager to quit it, and 
>nothing happens.  The problem is that once this happens, attempting to 
>relaunch MacPerl causes a freeze, and attempting to shut down/restart 
>causes a freeze -- because it can't quit the app, so it brings it forward 
>for you to quit, and you can't so if you try a force quit, it asks to 
>quit some other process, and you just can't get the machine to shut 
>down.
>
>An error type 12 is listed as an unimplemented core routine -- ie, 
>something that wants to pop up a debugger.  I don't have a debugger (like 
>MacsBug) installed -- and I would rather not have one....
>

First, what have you got against having a debugger loaded, at least (at 
times) in the development phase? Macsbug is not that hard to load. Move 
it in and out of the system folder and re-boot, and you can have it both 
ways, although not at the same time. I myself mostly use the extensions 
manager to dis/en-able it, on the rare occasions I want it out of the way.

Second, error type 12 from what? is this a system/cpu exception? If so, 
what you have is (apparently) an integer exception (according to Inside 
Macintosh Power PC System Software). What that means, I couldn't tell 
you. My copy of Inside Mac seems to be a little too old, says this 
exception is not used by the system. So, get on www.apple.com, go to 
developer, dink around in documentation, and you should find the most 
up-to-date editions. You might also try posting your question in a forum 
over there, or doing a search on the developer site.

Third, if this _is_ supposed to be calling a debugger, then maybe someone 
has left a breakpoint set in your code? This would be awkward. Might call 
for re-building a library?

>The closest that I can come to a possibility for the problem is if more 
>than one person tries to hit the server at the same time.  Is there any 
>way to solve this?  I _really_ need to be able to present a stable 
>platform here.

Anyway, without more specific information, the best I can offer is, 
install a debugger and use the help facilities ("help" command, in 
Macsbug) to find out how to show the current process ("help procinfo") 
and the call chain ("help sc"). When you catch the error next time, see 
what you can tell about where you were. See what kind of ideas that might 
give you. (But the Mac in its present form still doesn't really manage 
processes, so take what Macsbug says with a grain of salt.)

That's not very helpful. 

After you have an idea what to suspect, insert logging/debugging print 
statements around suspect code. Print out the state of any variable that 
might help you understand what is not going the way you think it should. 
Usually you print before the suspected pothole and after. That will yield 
a lot more information. 

I am reading from Learning Perl around p. 108. (Can't afford the rest at 
Japanese prices this month.) You might use something like 

warn "does this have anything to do with error 12";

and 

open(ERROR12LOG, ">>error_12_log");
print ERROR12LOG "suspect variable state when connecting is 
$suspect_variable\n";
close(ERROR12LOG);


But remember where you put debugging code, so you can take it out. C has 
the #define and #ifdef that let you maintain control over debugging code, 
and I think Perl has something similar, but I haven't seen it yet. In the 
meantime, put comments like 

#DEBUGGING error 12

around debugging code.

Be really careful about putting debugging print statements in other 
people's code. Don't, if you can avoid it. Suspect your code first, 
because it's hopefully easier to understand at this deep a level.

>
>Also, while I'm writing, is there some way to lock a file in MacOS -- I 
>need to make a change to it, and the only way I have is to read the file 
>in, close it, open it again, and overwrite it, which allows the file to 
>be changed in between.  And I'd rather not have that.

I'd be interested in knowing this, too. I see an flock operator in 
chapter 19 of this book. I don't see it in the index of MacPerl Power and 
Ease on line. (After I get the Camel, Chris.)

<http://www.macperl.com/ptf_book/>

>
>Thanks muchly,
>Ricky Morse
>Perl (somewhat) novice
>
># ===== Want to unsubscribe from this list?
># ===== Send mail with body "unsubscribe" to macperl-request@macperl.org
>
>

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org