NEURON deleting files

Anything that doesn't fit elsewhere.
Post Reply
hallockk
Posts: 43
Joined: Fri Jul 23, 2010 9:02 am

NEURON deleting files

Post by hallockk »

I've noticed that sometimes when NEURON crashes, it deletes whatever file is open at the time. Normally this happens when I try to save a file and I get an error that says "File not available of for saving", or something like that. After that warning, whenever close the file or NEURON crashes, the file is deleted.

Has anybody else noticed this?
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: NEURON deleting files

Post by ted »

hallockk wrote:I've noticed that sometimes when NEURON crashes, it deletes whatever file is open at the time. Normally this happens when I try to save a file
A bit more information would be helpful.

Please define "when NEURON crashes". How do you know it has "crashed"? What error message appears in the terminal?

Does the "crash" occur before, or after you try to write data to a file?

What file _is_ open at the time of the crash? Do you mean one of the the hoc or ses files that is part of your program? Or do you mean a data file that was opened by a hoc command?

Was it open _before_ the crash, or did you try to open it after the crash? If the latter, was the file opened for reading (by ropen()) or for writing (by wopen()), or was it accessed through the File class?

Or were you trying to use the GUI to save a ses file or write a picked Vector to a file?
an error that says "File not available of for saving", or something like that
What is the exact error message, please?
Has anybody else noticed this?
Not I.
hallockk
Posts: 43
Joined: Fri Jul 23, 2010 9:02 am

Re: NEURON deleting files

Post by hallockk »

The next time it happens I'll note down the exact error message. I posted just in case it was a known bug that I could avoid.

Thanks,

Kevin
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: NEURON deleting files

Post by ted »

Any answers to my other questions?
hallockk
Posts: 43
Joined: Fri Jul 23, 2010 9:02 am

Re: NEURON deleting files

Post by hallockk »

After several months of using neuron without this problem reoccuring, it happened again so I'll try to answer your questions.

From the GUI, I open and save a new SES file (CrashTest.ses). I make no changes to the file after it is saved. I close and reopen the file.
ted wrote: Please define "when NEURON crashes". How do you know it has "crashed"? What error message appears in the terminal?
Using the dropdown menu to save the session, I tell it to write over the current file. No changes were made to the file, but the error only occurs when I try to write over an existing file.

Here is the exact error message:

nrniv: ./CrashTest.ses is not open for writing
near line 8
{save_session("./CrashTest.ses","{load_file(\"nrngui.hoc\")}")}
^
save_session("./CrashTest.ses""{load_file("nrngui.hoc")}" , )
NEURONMainMenu[0].execute("save_session("./CrashTest.ses","{load_file(\"nrngui.hoc\")}")" )
NEURONMainMenu[0].save_ses_nrnmainmenu( )

After I receive the error, I can write the file to a different name, but whenever I close NEURON next, the original file will be deleted.
ted wrote: Does the "crash" occur before, or after you try to write data to a file?
The error and deletion occurs after I try try to save the file.
ted wrote: What file _is_ open at the time of the crash? Do you mean one of the the hoc or ses files that is part of your program? Or do you mean a data file that was opened by a hoc command?


It's an SES file, although the name might have changed if I save it under a different file name.
ted wrote: Was it open _before_ the crash, or did you try to open it after the crash? If the latter, was the file opened for reading (by ropen()) or for writing (by wopen()), or was it accessed through the File class?
The file is open beforehand and it's opened by double-clicking on the icon and letting NEUROn open up the GUI. I'm using a Windows XP computer.
ted wrote: Or were you trying to use the GUI to save a ses file or write a picked Vector to a file?

An SES file.

Currently it's reproducible so if you'd like for me to do additional tests, I'd be happy to try.

Thanks.
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: NEURON deleting files

Post by ted »

Thanks for picking up this thread. Obscure bugs require persistence to track down.
hallockk wrote:From the GUI, I open and save a new SES file (CrashTest.ses). I make no changes to the file after it is saved. I close and reopen the file.
. . .
Using the dropdown menu to save the session, I tell it to write over the current file. No changes were made to the file, but the error only occurs when I try to write over an existing file.
I got all the way to this point without any problems at all, so probably I did something different--but what?

First, exactly what version of NEURON are you using (what does the first line of NEURON's "welcome message" say?), and on what platform?
hallockk wrote:From the GUI, I open and save a new SES file (CrashTest.ses). I make no changes to the file after it is saved. I close and reopen the file.
"close and reopen" means what, exactly? Is the actual sequence "exited NEURON, then restarted NEURON and used NEURON Main Menu / File / load session"? If not, exactly what steps did you take?
hallockk
Posts: 43
Joined: Fri Jul 23, 2010 9:02 am

Re: NEURON deleting files

Post by hallockk »

Thanks for looking into this.
ted wrote:First, exactly what version of NEURON are you using (what does the first line of NEURON's "welcome message" say?), and on what platform?
NEURON -- Release 7.1 (359:7f113b76a94b) 2009-10-26
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2008
See http://www.neuron.yale.edu/credits.html

I'm running it on Windows XP Professional Edition Service Pack 3.
ted wrote: "close and reopen" means what, exactly? Is the actual sequence "exited NEURON, then restarted NEURON and used NEURON Main Menu / File / load session"? If not, exactly what steps did you take?
I open a new file by double-clicking on the nrngui shortcut within the NEURON 7.1 folder. I save the file (CrashTest.ses) in a working folder within the NEURON 7.1 folder using the "save session" option from the File menu. I then Quit the session by selecting the Quit option from the same menu. I then open CrashTest.ses by double-clicking on the file (with the following opening message):

NEURON -- Release 7.1 (359:7f113b76a94b) 2009-10-26
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2008
See http://www.neuron.yale.edu/credits.html

loading membrane mechanisms from nrnmech.dll
Additional mechanisms from files
ipulse1.mod ipulse2.mod

ipulse1.mod and ipusle2.mod are MOD files I downloaded from the NEURON website.

With the file open, I use "save session" from the File menu again to save the file under the same name, getting the following error:

oc>nrniv: ./CrashTest.ses is not open for writing
near line 8
{save_session("./CrashTest.ses","{load_file(\"nrngui.hoc\")}")}
^
save_session("./CrashTest.ses""{load_file("nrngui.hoc")}" , )
NEURONMainMenu[0].execute("save_session("./CrashTest.ses","{load_file(\"nrngui.hoc\")}")" )
NEURONMainMenu[0].save_ses_nrnmainmenu( )

When I select quit from the File menu, CrashTest.ses is deleted.

I have created files in other directories, but the behavior and error is the same when I try to overwrite them. (I wanted to see if the MOD files were contributing to the problem, but they don't seem to be.)
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Maybe MSWin deleting files?

Post by ted »

Notice that I have changed the "Subject" of my post to reflect what may really be happening. More about this below.
hallockk wrote:I then open CrashTest.ses by double-clicking on the file
Double clicking on a ses file launches NEURON? Not for me, it doesn't. You must have told MSWin what to do with ses files.
With the file open, I use "save session" from the File menu again to save the file under the same name, getting the following error:
. . .
When I select quit from the File menu, CrashTest.ses is deleted.
Can't say I have ever seen or heard of anything like this under WinNT, Win2K, or WinXP with any version of NEURON. And it didn't happen today for me with 7.2 under WinXP.

That said, my first suggestion is to uninstall NEURON 7.1 (use the uninstaller in the NEURON Program Group, in the Start menu), and install the most recent alpha version 7.2 for MSWin, just in case you're running into some obscure bug in NEURON itself.

If that doesn't take care of the problem, I can only surmise that you're running into a "feature" of MSWin, which since Win 3.1 has prevented write access to a file that has already been opened by another process. The usual symptom of this "feature" is that a NEURON user has double clicked on a hoc file, then while NEURON is still running uses a text editor to make a change in the hoc file, tries to save the revised hoc file to disk, but MSWin refuses and issues an error message to the effect that "the process cannot access the file because the file is being used by another process." This is called "file locking" and it's a pain in the sitzfleisch. The error message
. . . is not open for writing
is certainly consistent with this.

Somehow this never happens under UNIX/Linux/OS X, which know how to handle such situations gracefully without blocking or even notifying the user. Well, you get what you pay for.

That said, I haven't seen file locking occur with ses files, so maybe there's something extra finicky about your particular installation of WinXP.

So what do you do if installing NEURON 7.2 doesn't eliminate the problem? You could respond to
. . . is not open for writing
messages by trying again but entering a different name for the ses file.

Or, on the chance that WinXP is finicky only because it "knows" what to do with .ses files, you could make it forget what it knows about them. To do this, start an MSWin directory browser ("Windows Explorer"), use its File types menu (Tools / Folder options/ File types) to search for the .ses extension, then click on the Advanced button and change the registry settings that tell MSWin to open .ses files with NEURON. You'll probably have to be Administrator to do this.
hallockk
Posts: 43
Joined: Fri Jul 23, 2010 9:02 am

Re: Maybe MSWin deleting files?

Post by hallockk »

ted wrote:Notice that I have changed the "Subject" of my post to reflect what may really be happening. More about this below.
This seems to be what's happening. If I use "load session" from the File menu, I can repeatedly use the same file name to save a file. It's definitely a Windows "feature."

As you suggested, I changed the behavior of SES files and that should take care of the problem.

Thanks!
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Maybe MSWin deleting files?

Post by ted »

hallockk wrote:As you suggested, I changed the behavior of SES files and that should take care of the problem.
Did it in fact eliminate the problem?
hallockk
Posts: 43
Joined: Fri Jul 23, 2010 9:02 am

Re: Maybe MSWin deleting files?

Post by hallockk »

ted wrote: Did it in fact eliminate the problem?
I switched it so that double-clicking would open the file in WordPad (a text editor). This prevents me from forgetting to open SES files using the menu option. When the load session menu option is used, the files can be saved under the same name, which takes care of the problem as far as I'm concerned.

Thanks again.
Post Reply