Como posso determinar o que está bloqueando este arquivo de rede

2

(uma pergunta semelhante foi perguntado por mim antes - esta questão refere-se à mesma aplicação, mas a um problema diferente - mas provavelmente relacionado -

Eu tenho um aplicativo que grava regularmente registros em um arquivo de dados. O arquivo é aberto, atualizado e fechado a cada vez. Essa mesma instância do aplicativo também lê o arquivo.

Em outras partes da rede, há várias instâncias "escrava" do mesmo aplicativo em execução que só lêem o mesmo arquivo de dados na rede.

Ocasionalmente (as ocasiões são dias, às vezes semanas à parte), o acesso a arquivos falha com um erro de acesso negado em todas as máquinas e no mesmo instante, exceto que às vezes falha em todas as máquinas além de um dos escravos. O arquivo não pode ser gravado ou lido. Normalmente, todos os PCs, além de um, falham da mesma forma - código de erro "acesso negado" 5 - mas, às vezes, um dos escravos ainda pode continuar acessando o arquivo.

A inspeção do sistema com utilitários que informam quem tem um arquivo aberto ( LockHunter , o utilitário Handle da SysInternal) nos diz pouco - no PC que grava no arquivo, eles descobrem que System processa , presumivelmente porque o aplicativo que tem o arquivo aberto o abriu por meio de um compartilhamento de rede, o Escravo que ainda pode gravar no arquivo mostra o identificador como desbloqueado e, com os outros escravos, nenhum utilitário reporta nada.

Quando estamos solucionando problemas no sistema, usamos NotePad para testar rapidamente se o arquivo está desbloqueado. O Bloco de Notas sempre relata que não pode abrir o arquivo porque outro aplicativo tem o arquivo aberto - exceto por uma das máquinas escravas, e nem sempre a mesma. Quando abrimos o arquivo com NotePad no PC, ele abre sem reclamar e, no mesmo instante, o arquivo é desbloqueado - todos os outros PCs podem ler e gravar no arquivo a partir de então (embora as coisas pareçam funcionar bem) depois, não estou convencido de que o sistema de arquivos não tenha sido danificado de alguma forma).

O seguinte é um log obtido por ProcMon das operações do sistema de arquivos escravo durante o período em que Notepad é usado para "descolar" o arquivo. O arquivo APP.ZZZ é lido a cada segundo, correspondendo a cada grupo de 5 acessos de App.exe

... accesses from the remote machine

1:08:59.5706074 p.m.    App.exe 6276    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"
1:08:59.7993871 p.m.    App.exe 6276    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"
1:08:59.8081861 p.m.    App.exe 6276    CreateFile  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: None, AllocationSize: n/a, OpenResult: Opened"
1:08:59.8083675 p.m.    App.exe 6276    QueryBasicInformationFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "CreationTime: 17/11/2014 5:46:01 p.m., LastAccessTime: 23/09/2015 4:00:01 a.m., LastWriteTime: 23/09/2015 11:53:21 a.m., ChangeTime: 23/09/2015 11:53:21 a.m., FileAttributes: ANCI"
1:08:59.8083874 p.m.    App.exe 6276    CloseFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS 

1:09:00.5663175 p.m.    App.exe 6276    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"
1:09:00.7611667 p.m.    App.exe 6276    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"
1:09:00.7669819 p.m.    App.exe 6276    CreateFile  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: None, AllocationSize: n/a, OpenResult: Opened"
1:09:00.7671534 p.m.    App.exe 6276    QueryBasicInformationFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "CreationTime: 17/11/2014 5:46:01 p.m., LastAccessTime: 23/09/2015 4:00:01 a.m., LastWriteTime: 23/09/2015 11:53:21 a.m., ChangeTime: 23/09/2015 11:53:21 a.m., FileAttributes: ANCI"
1:09:00.7671720 p.m.    App.exe 6276    CloseFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS 

1:09:01.5654203 p.m.    App.exe 6276    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"

... NOTEPAD starts and opens the file    

1:09:01.7112007 p.m.    NOTEPAD.EXE 4508    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"
1:09:01.7187932 p.m.    NOTEPAD.EXE 4508    CreateFile  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a, OpenResult: Opened"
1:09:01.7233678 p.m.    NOTEPAD.EXE 4508    QueryInformationVolume  \REMOTE\App\Datafiles\APP.ZZZ  BUFFER OVERFLOW "VolumeCreationTime: 13/02/2014 11:58:47 a.m., VolumeSerialNumber: 6060-4BB9, SupportsObjects: True, VolumeLabel: Win?"
1:09:01.7248358 p.m.    NOTEPAD.EXE 4508    QueryAllInformationFile \REMOTE\App\Datafiles\APP.ZZZ  BUFFER OVERFLOW "CreationTime: 17/11/2014 5:46:01 p.m., LastAccessTime: 23/09/2015 4:00:01 a.m., LastWriteTime: 23/09/2015 11:53:21 a.m., ChangeTime: 23/09/2015 11:53:21 a.m., FileAttributes: ANCI, AllocationSize: 692,224, EndOfFile: 691,600, NumberOfLinks: 1, DeletePending: False, Directory: False, IndexNumber: 0x1000000000bdb5, EaSize: 0, Access: None 0x0, Position: 0, Mode: , AlignmentRequirement: Byte"
1:09:01.7407505 p.m.    NOTEPAD.EXE 4508    CreateFileMapping   \REMOTE\App\Datafiles\APP.ZZZ  FILE LOCKED WITH WRITERS    "SyncType: SyncTypeCreateSection, PageProtection: "
1:09:01.7407840 p.m.    NOTEPAD.EXE 4508    QueryStandardInformationFile    \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "AllocationSize: 692,224, EndOfFile: 691,600, NumberOfLinks: 1, DeletePending: False, Directory: False"
1:09:01.7408038 p.m.    NOTEPAD.EXE 4508    CreateFileMapping   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS SyncType: SyncTypeOther
1:09:01.7408244 p.m.    NOTEPAD.EXE 4508    CloseFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS 
1:09:01.7408578 p.m.    NOTEPAD.EXE 4508    ReadFile    \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Offset: 0, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal"
1:09:01.7459986 p.m.    NOTEPAD.EXE 4508    ReadFile    \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Offset: 32,768, Length: 32,768, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal"
1:09:01.7502571 p.m.    NOTEPAD.EXE 4508    ReadFile    \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Offset: 65,536, Length: 65,536, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal"
1:09:01.7567997 p.m.    NOTEPAD.EXE 4508    ReadFile    \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Offset: 131,072, Length: 131,072, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal"
1:09:01.7759753 p.m.    NOTEPAD.EXE 4508    ReadFile    \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Offset: 262,144, Length: 262,144, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal"
1:09:01.7995374 p.m.    NOTEPAD.EXE 4508    ReadFile    \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Offset: 524,288, Length: 167,312, I/O Flags: Non-cached, Paging I/O, Synchronous Paging I/O, Priority: Normal"
1:09:01.8194679 p.m.    NOTEPAD.EXE 4508    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"

1:09:01.8228119 p.m.    NOTEPAD.EXE 4508    RegQueryValue   HKLM\SOFTWARE\MICROSOFT\Windows\CurrentVersion\Explorer\KindMap\.ZZZ    NAME NOT FOUND  Length: 144

.... NOTEPAD does a whole bunch of registry stuff

1:09:01.8245487 p.m.    NOTEPAD.EXE 4508    RegCloseKey HKCU\Software\Classes\.ZZZ  SUCCESS 

... accesses from the remote machine again. File is now unstuck. 

1:09:01.9170334 p.m.    App.exe 6276    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"
1:09:01.9249583 p.m.    App.exe 6276    CreateFile  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: None, AllocationSize: n/a, OpenResult: Opened"
1:09:01.9287995 p.m.    App.exe 6276    QueryBasicInformationFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "CreationTime: 17/11/2014 5:46:01 p.m., LastAccessTime: 23/09/2015 4:00:01 a.m., LastWriteTime: 23/09/2015 11:53:21 a.m., ChangeTime: 23/09/2015 11:53:21 a.m., FileAttributes: ANCI"
1:09:01.9288154 p.m.    App.exe 6276    CloseFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS 

1:09:02.5679077 p.m.    App.exe 6276    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"
1:09:02.8324048 p.m.    App.exe 6276    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"
1:09:02.8813660 p.m.    App.exe 6276    CreateFile  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: None, AllocationSize: n/a, OpenResult: Opened"
1:09:02.8924965 p.m.    App.exe 6276    QueryBasicInformationFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "CreationTime: 17/11/2014 5:46:01 p.m., LastAccessTime: 23/09/2015 4:00:01 a.m., LastWriteTime: 23/09/2015 1:09:02 p.m., ChangeTime: 23/09/2015 1:09:02 p.m., FileAttributes: ANCI"
1:09:02.8925206 p.m.    App.exe 6276    CloseFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS 

1:09:03.5661778 p.m.    App.exe 6276    CreateFile  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a, OpenResult: Opened"
1:09:03.5749668 p.m.    App.exe 6276    ReadFile    \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Offset: 630,252, Length: 61,376, Priority: Normal"
1:09:03.5750069 p.m.    App.exe 6276    ReadFile    \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Offset: 626,688, Length: 64,940, I/O Flags: Non-cached, Paging I/O, Priority: Normal"
1:09:03.5820100 p.m.    App.exe 6276    CloseFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS 

1:09:03.5862665 p.m.    App.exe 6276    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"
1:09:03.7772397 p.m.    App.exe 6276    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"
1:09:03.7848388 p.m.    App.exe 6276    CreateFile  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: None, AllocationSize: n/a, OpenResult: Opened"
1:09:03.7880212 p.m.    App.exe 6276    QueryBasicInformationFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "CreationTime: 17/11/2014 5:46:01 p.m., LastAccessTime: 23/09/2015 4:00:01 a.m., LastWriteTime: 23/09/2015 1:09:02 p.m., ChangeTime: 23/09/2015 1:09:02 p.m., FileAttributes: ANCI"
1:09:03.7880374 p.m.    App.exe 6276    CloseFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS 

1:09:04.5695737 p.m.    App.exe 6276    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"
1:09:04.7597043 p.m.    App.exe 6276    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"
1:09:04.7653450 p.m.    App.exe 6276    CreateFile  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: None, AllocationSize: n/a, OpenResult: Opened"
1:09:04.7711026 p.m.    App.exe 6276    QueryBasicInformationFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "CreationTime: 17/11/2014 5:46:01 p.m., LastAccessTime: 23/09/2015 4:00:01 a.m., LastWriteTime: 23/09/2015 1:09:04 p.m., ChangeTime: 23/09/2015 1:09:04 p.m., FileAttributes: ANCI"
1:09:04.7711189 p.m.    App.exe 6276    CloseFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS 

1:09:05.5674975 p.m.    App.exe 6276    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"
1:09:05.7744582 p.m.    App.exe 6276    QueryDirectory  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Filter: APP.ZZZ, 1: APP.ZZZ"
1:09:05.7818819 p.m.    App.exe 6276    CreateFile  \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: None, AllocationSize: n/a, OpenResult: Opened"
1:09:05.7898488 p.m.    App.exe 6276    QueryBasicInformationFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS "CreationTime: 17/11/2014 5:46:01 p.m., LastAccessTime: 23/09/2015 4:00:01 a.m., LastWriteTime: 23/09/2015 1:09:04 p.m., ChangeTime: 23/09/2015 1:09:04 p.m., FileAttributes: ANCI"
1:09:05.7898647 p.m.    App.exe 6276    CloseFile   \REMOTE\App\Datafiles\APP.ZZZ  SUCCESS 

Estou tentando determinar o que está colocando o arquivo de dados nesse estado. Lembro-me de ver uma referência a problemas se uma exceção ocorre quando um arquivo de rede é fechado. Este problema poderia apontar para algo dessa natureza? Espero que alguém possa oferecer algumas dicas sobre o que pode estar acontecendo.

O aplicativo está escrito em Delphi 2007 (32 bits).

    
por rossmcm 07.10.2015 / 03:02

1 resposta

3

Abra o "Prompt de comando" e digite

openfiles

Para ver as opções

openfiles /?

O outro método é

  • Selecione "Gerenciar computador" (Abrir "Gerenciamento do computador")
  • clique em "Pastas compartilhadas"
  • escolha "Abrir arquivos"
por 07.10.2015 / 03:19