Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Random (?) severe error 38

jirina
New Contributor I
1,628 Views
I am running a console application which is randomly crashing. The error is "forrtl: severe (38): error during write, unit ..., file ..." and there is also a message "The requested operation cannot be performed on a file with a user-mapped section open." displayed.

I am running a release version with traceback enabled to see the location in the source code where the error occurs. The command line options are

/nologo /Oy- /D_OPENMP_ /fixed /extend_source:132 /Qopenmp /fpscomp:general /assume:byterecl /module:"Release" /object:"Release" /traceback /libs:static /threads /c

an the additional options are

/align:all /heap-arrays


The main problem is that the above described error occurs randomly, sometimes after 1 hour, sometimes after half day of calculating. In addition, it seems to occur at different locations of the source code. This means that using debugger would probably not help.

I am trying to write to file which is opened before an iteration starts (and is closed at its end) like this:

WRITE(filename,'(a,i9.9,a)') 'temp_', iter, '.txt' ! character*20 filename
OPEN ( iunxs, FILE=filename, ACCESS='SEQUENTIAL', ACTION='READWRITE', SHARE='DENYWR', IOSTAT=ierr )


READWRITE is specified because of using BACKSPACE.

The strangest thing is that several write commands are successful before the error occurs. It seems to me that writing something like this (the location in the source code indicated by traceback)

WRITE ( iunxs, '(a)' ) ' Energy - writing fields to disc '

should not cause any problem.

I thought that the error could be caused by using BACKSPACE ( iunxs ), but this command is successfully used several times before the error. And also, it happened once that the error occurred during the first attempt to write to the (empty) file like this: WRITE ( iunxs, * ).

Is there anything what I can try to find the cause of this problem?

Update 2008-09-17 20:49 CET: I start to be really desperate - the severe error 38 keeps occurring, randomly and without any clue what could be wrong. The source code in the case of the latest crash is:

OPEN ( 11, FILE='balance.txt',
+ ACCESS='SEQUENTIAL', ACTION='WRITE', SHARE='DENYWR', IOSTAT=ios )
if ( ios.eq.0 ) then
call write_header ( 11 )
endif
...

subroutine write_header ( iof )
use ifport
integer*4 iof
integer*2 syshr, sysmin, syssec, syshsec
integer*2 sysyear, sysmonth, sysday

&nb sp; call gettim ( syshr, sysmin, syssec, syshsec )
call getdat ( sysyear, sysmonth, sysday )

write(iof,'(a)') ' ' ! 2008-09-16 -> write(iof,*) tested too - crashes
write(iof,'(2a)') ' -------------',
+ '-------------------------------------------------------'
write(iof,*)
write(iof,'(a,i4.4,4(a,i2.2))')
+ ' Date [year-month-day]: ', sysyear, '-', sysmonth, '-', sysday,
+ ', Time [hr-min]: ', syshr, '-', sysmin
write(iof,*)
...

return
end


Is there any reason why there would be the severe error 38 for the line indicated by bold? Sad smiley [:(]
0 Kudos
4 Replies
sbeck65
Beginner
1,628 Views
Hi, I just wanted to let you know that I am experiencing the exact same problem. I am running a code that opens and closes multiple files and performs multiple iterations. It is randomly stopping and giving me the "severe (38) ...user-mapped section open...." error. Sometimes it will run for 30 minutes, sometimes for several hours before crashing. And to add another issue, it will crash on some PCs and not others.
I work from home and it doesn't crash for me, but it randomly crashes for my boss. Unfortunately, for me, I don't even live in the same state where my boss is, so I can't just go over to his computer to see what is happening. From the sounds of it, I don't think that would help much anyway.
I don't think the problem is with your use of BACKSPACE - I am not using that command.
I am wondering if it is somehow interfering with another program that might be running on my boss's computer (maybe his internet security program?) Like you, I am desperate for an answer to this annoying problem!
Quoting - jirina
I am running a console application which is randomly crashing. The error is "forrtl: severe (38): error during write, unit ..., file ..." and there is also a message "The requested operation cannot be performed on a file with a user-mapped section open." displayed.

I am running a release version with traceback enabled to see the location in the source code where the error occurs. The command line options are

/nologo /Oy- /D_OPENMP_ /fixed /extend_source:132 /Qopenmp /fpscomp:general /assume:byterecl /module:"Release" /object:"Release" /traceback /libs:static /threads /c

an the additional options are

/align:all /heap-arrays


The main problem is that the above described error occurs randomly, sometimes after 1 hour, sometimes after half day of calculating. In addition, it seems to occur at different locations of the source code. This means that using debugger would probably not help.

I am trying to write to file which is opened before an iteration starts (and is closed at its end) like this:

WRITE(filename,'(a,i9.9,a)') 'temp_', iter, '.txt' ! character*20 filename
OPEN ( iunxs, FILE=filename, ACCESS='SEQUENTIAL', ACTION='READWRITE', SHARE='DENYWR', IOSTAT=ierr )


READWRITE is specified because of using BACKSPACE.

The strangest thing is that several write commands are successful before the error occurs. It seems to me that writing something like this (the location in the source code indicated by traceback)

WRITE ( iunxs, '(a)' ) ' Energy - writing fields to disc '

should not cause any problem.

I thought that the error could be caused by using BACKSPACE ( iunxs ), but this command is successfully used several times before the error. And also, it happened once that the error occurred during the first attempt to write to the (empty) file like this: WRITE ( iunxs, * ).

Is there anything what I can try to find the cause of this problem?

Update 2008-09-17 20:49 CET: I start to be really desperate - the severe error 38 keeps occurring, randomly and without any clue what could be wrong. The source code in the case of the latest crash is:

OPEN ( 11, FILE='balance.txt',
+ ACCESS='SEQUENTIAL', ACTION='WRITE', SHARE='DENYWR', IOSTAT=ios )
if ( ios.eq.0 ) then
call write_header ( 11 )
endif
...

subroutine write_header ( iof )
use ifport
integer*4 iof
integer*2 syshr, sysmin, syssec, syshsec
integer*2 sysyear, sysmonth, sysday

&nb sp; call gettim ( syshr, sysmin, syssec, syshsec )
call getdat ( sysyear, sysmonth, sysday )

write(iof,'(a)') ' ' ! 2008-09-16 -> write(iof,*) tested too - crashes
write(iof,'(2a)') ' -------------',
+ '-------------------------------------------------------'
write(iof,*)
write(iof,'(a,i4.4,4(a,i2.2))')
+ ' Date [year-month-day]: ', sysyear, '-', sysmonth, '-', sysday,
+ ', Time [hr-min]: ', syshr, '-', sysmin
write(iof,*)
...

return
end


Is there any reason why there would be the severe error 38 for the line indicated by bold? Sad smiley [:(]

0 Kudos
Steven_L_Intel1
Employee
1,628 Views

What is happening is that Windows is returning an error for the write operation (the call to the Win32 API WriteFile routine which is what the Fortran library uses to implement WRITE.) This is not one of the errors for which a separate Fortran error code is available, so you get 38, "Error during WRITE".

It's Windows, or something on your system, that is causing this. It's not under the control of the Fortran library. You may have an antivirus or backup program that is interfering with file writes (most antivirus programs intercept file operations.) If you can reproduce this fairly easily, try disabling your antivirus temporarily and see if that changes the behavior.

0 Kudos
sbeck65
Beginner
1,628 Views
THANK YOU! I was wondering if that was the problem since it was occurring on some computers and not others. My boss had 2 computers, both had TREND Micro Security System on them. It crashed on one (the one at the office), but not on his computer at home which had a cheaper version of the program. I am guessing the one at home only had the antivirus and the office had the full internet security suite. So, to test my theory, I bought the full version of TREND Micro Internet Security Suite for my computer- and the code CRASHED with the same error he was getting. It had never crashed on any of my computers at home before. I am using Kaspersky Internet Security at home, but have used Webroot in the past without problems also.
I'm not sure what the office will do about this problem - but at least I can stop going in circles trying to "fix" my code.

0 Kudos
jirina
New Contributor I
1,628 Views
I have come across the "severe(38)" problem recently and I think I finally found the cause of it - I am using Comodo Firewall which contains a component called "Defense+". This component is a host intrusion prevention system monitoring activities of all executable files. After I disabled it, my Fortran applications stopped crashing with the "severe(38)" error. Maybe this information will help somebody dealing with the same problem and desperately trying to find a "bug" in the source code.
0 Kudos
Reply