EDN Admin
Well-known member
<p style=" Hi,
<p style=" I am seeing a strange problem in my project where perl could not see a file though it is present in the disk. We run a series of short backend jobs ( each spanning 10 s ) through perl. The backend job write an output file and exit, later which
perl process would try to transfer it. The perl process is threaded where master thread acts as listener waiting for connection/messages and send file list to child thread ( by checking for file existence ) about what files to transfer. And child
thread does the actual file transfer.
<p style=" The job runs fine initially and all of a sudden master thread fail to detect file written by the backend. Debugging perl code ( 5.10.1 from http://www.cpan.org/src/ http://www.cpan.org/src/ ), I found stati64 of
CRT fail and return -1. On retry, the call seem to work fine. I can guarantee there there is no race condition involved by backend process as we try to access the file in perl only after backend exit. I also tried to capture the events using ProcMon enabling
File System Activity and made sure there are no external process accessing the file. When the failure happens with stati64, I see the following events in procmon -
<p style=" <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px Time of Day<span style="white-space
re
Process Name<span style="white-space
re PID<span style="white-space
re
TID<span style="white-space
re Operation<span style="white-space
re
Path<span style="white-space
re Result<span style="white-space
re
Detail<span style="white-space
re Description
<p style="
<p style=" <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px 5:20:59.5315529 PM<span style="white-space
re
perl.exe<span style="white-space
re 3444<span style="white-space
re
3496<span style="white-space
re CreateFile<span style="white-space
re
D:scrrajagopatest_31test_31.01.mae<span style="white-space
re
SUCCESS<span style="white-space
re Desired Access: Read Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: n/a, ShareMode: None, AllocationSize: n/a, OpenResult: Opened<span style="white-space
re
n/a<span style="white-space
re NYCrajagopa
<p style=" <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px 5:20:59.5315965 PM<span style="white-space
re
perl.exe<span style="white-space
re 3444<span style="white-space
re
1636<span style="white-space
re DeviceIoControl<span style="white-space
re
D:scrrajagopatest_31nyc-bld-w06-0-4eb305ae<span style="white-space
re
INVALID PARAMETER<span style="white-space
re Control: 0x12043 (Device:0x1 Function:2064 Method: 3)<span style="white-space
re
n/a<span style="white-space
re NYCrajagopa
<p style=" <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px 5:20:59.5316010 PM<span style="white-space
re
perl.exe<span style="white-space
re 3444<span style="white-space
re
3496<span style="white-space
re QueryInformationVolume<span style="white-space
re
D:scrrajagopatest_31test_31.01.mae<span style="white-space
re
SUCCESS<span style="white-space
re VolumeCreationTime: 1/20/2011 7:34:15 PM, VolumeSerialNumber: 188D-F175, SupportsObjects: True, VolumeLabel: scr<span style="white-space
re
n/a<span style="white-space
re NYCrajagopa
<p style=" <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px 5:20:59.5316301 PM<span style="white-space
re
perl.exe<span style="white-space
re 3444<span style="white-space
re
3496<span style="white-space
re QueryAllInformationFile<span style="white-space
re
D:scrrajagopatest_31test_31.01.mae<span style="white-space
re
BUFFER OVERFLOW<span style="white-space
re CreationTime: 11/3/2011 5:20:47 PM, LastAccessTime: 11/3/2011 5:20:47 PM, LastWriteTime: 11/3/2011 5:20:47 PM, ChangeTime: 11/3/2011 5:20:47 PM, FileAttributes: A, AllocationSize: 128, EndOfFile: 126, NumberOfLinks:
1, DeletePending: False, Directory: False, IndexNumber: 0x8e00000002f208, EaSize: 0, Access: Read Attributes, Synchronize, Position: 0, Mode: Synchronous IO Non-Alert, AlignmentRequirement: Word<span style="white-space
re
n/a<span style="white-space
re NYCrajagopa
<p style=" <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px 5:20:59.5316368 PM<span style="white-space
re
perl.exe<span style="white-space
re 3444<span style="white-space
re
1636<span style="white-space
re DeviceIoControl<span style="white-space
re
D:scrrajagopatest_31nyc-bld-w06-0-4eb305ae<span style="white-space
re
INVALID PARAMETER<span style="white-space
re Control: 0x12043 (Device:0x1 Function:2064 Method: 3)<span style="white-space
re
n/a<span style="white-space
re NYCrajagopa
<p style=" <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px 5:20:59.5316622 PM<span style="white-space
re
perl.exe<span style="white-space
re 3444<span style="white-space
re
3496<span style="white-space
re CloseFile<span style="white-space
re
D:scrrajagopatest_31test_31.01.mae<span style="white-space
re
SUCCESS<span style="white-space
re n/a<span style="white-space
re
NYCrajagopa
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
As you can see, the set of file operations involved with "test_31.01.mae" using stati64 is shown as SUCCESS. But the result of stati64(..) is -1 and GetLastError(..) give 6. Why would this be? Is procmon showing wrong status? Is stati64 buggy in threaded
environment? Is it safe to retry the stati64 call if return value is -1 and GetLastError() is 6? Please throw pointers as this issue is important to fix soon.
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
-Karthik
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
View the full article
<p style=" I am seeing a strange problem in my project where perl could not see a file though it is present in the disk. We run a series of short backend jobs ( each spanning 10 s ) through perl. The backend job write an output file and exit, later which
perl process would try to transfer it. The perl process is threaded where master thread acts as listener waiting for connection/messages and send file list to child thread ( by checking for file existence ) about what files to transfer. And child
thread does the actual file transfer.
<p style=" The job runs fine initially and all of a sudden master thread fail to detect file written by the backend. Debugging perl code ( 5.10.1 from http://www.cpan.org/src/ http://www.cpan.org/src/ ), I found stati64 of
CRT fail and return -1. On retry, the call seem to work fine. I can guarantee there there is no race condition involved by backend process as we try to access the file in perl only after backend exit. I also tried to capture the events using ProcMon enabling
File System Activity and made sure there are no external process accessing the file. When the failure happens with stati64, I see the following events in procmon -
<p style=" <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px Time of Day<span style="white-space

Process Name<span style="white-space


TID<span style="white-space


Path<span style="white-space


Detail<span style="white-space

<p style="
<p style=" <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px 5:20:59.5315529 PM<span style="white-space

perl.exe<span style="white-space


3496<span style="white-space


D:scrrajagopatest_31test_31.01.mae<span style="white-space

SUCCESS<span style="white-space


n/a<span style="white-space

<p style=" <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px 5:20:59.5315965 PM<span style="white-space

perl.exe<span style="white-space


1636<span style="white-space


D:scrrajagopatest_31nyc-bld-w06-0-4eb305ae<span style="white-space

INVALID PARAMETER<span style="white-space


n/a<span style="white-space

<p style=" <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px 5:20:59.5316010 PM<span style="white-space

perl.exe<span style="white-space


3496<span style="white-space


D:scrrajagopatest_31test_31.01.mae<span style="white-space

SUCCESS<span style="white-space


n/a<span style="white-space

<p style=" <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px 5:20:59.5316301 PM<span style="white-space

perl.exe<span style="white-space


3496<span style="white-space


D:scrrajagopatest_31test_31.01.mae<span style="white-space

BUFFER OVERFLOW<span style="white-space

1, DeletePending: False, Directory: False, IndexNumber: 0x8e00000002f208, EaSize: 0, Access: Read Attributes, Synchronize, Position: 0, Mode: Synchronous IO Non-Alert, AlignmentRequirement: Word<span style="white-space

n/a<span style="white-space

<p style=" <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px 5:20:59.5316368 PM<span style="white-space

perl.exe<span style="white-space


1636<span style="white-space


D:scrrajagopatest_31nyc-bld-w06-0-4eb305ae<span style="white-space

INVALID PARAMETER<span style="white-space


n/a<span style="white-space

<p style=" <span style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif <span style="font-size:14px; line-height:18px 5:20:59.5316622 PM<span style="white-space

perl.exe<span style="white-space


3496<span style="white-space


D:scrrajagopatest_31test_31.01.mae<span style="white-space

SUCCESS<span style="white-space


NYCrajagopa
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
As you can see, the set of file operations involved with "test_31.01.mae" using stati64 is shown as SUCCESS. But the result of stati64(..) is -1 and GetLastError(..) give 6. Why would this be? Is procmon showing wrong status? Is stati64 buggy in threaded
environment? Is it safe to retry the stati64 call if return value is -1 and GetLastError() is 6? Please throw pointers as this issue is important to fix soon.
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
-Karthik
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
<div style="font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif; font-size:14px; line-height:18px
View the full article