Skip to content

Instantly share code, notes, and snippets.

@vitorebatista
Created July 9, 2018 14:21
Show Gist options
  • Save vitorebatista/bacae31b17fe3f46cdc2b27d42b04235 to your computer and use it in GitHub Desktop.
Save vitorebatista/bacae31b17fe3f46cdc2b27d42b04235 to your computer and use it in GitHub Desktop.
User Function TestTarThread()
Local nThread
For nThread := 1 To 2
StartJob('U_TestTar', GetEnvServer(), .F.,)
Next nThread
Return
User Function TestTar()
Local cThreadId := AllTrim( Str( ThreadId() ) )
Local cBarra := If(isSRVunix(),"/","\")
Local cCurDir := CurDir() + If(cBarra $ CurDir(), "" , cBarra )
Local cTmpDir := "testtar" + cThreadId + cBarra
Local cFile1 := cCurDir + cBarra + cTmpDir + "file1.json"
Local cFile2 := cCurDir + cBarra + cTmpDir + "file2.json"
Local cFile3 := cCurDir + cBarra + cTmpDir + "file3.json"
Local aFiles := { cFile1, cFile2, cFile3 }
Local cTarFile := cCurDir + cTmpDir + 'tarfile.tar'
Local cTarGzFile := cCurDir + cTmpDir + 'targzfile.tar.gz'
Local nX
If !ExistDir( cCurDir + cTmpDir )
MakeDir( cCurDir + cTmpDir )
EndIf
For nX := 1 To 100
Printf(cValtoChar(nX))
nFile1 := FCreate( cFile1 )
nFile2 := FCreate( cFile2 )
nFile3 := FCreate( cFile3 )
FWrite( nFile1, '[ ]' )
FWrite( nFile2, '[ ]' )
FWrite( nFile3, '[ ]' )
FClose( nFile1 )
FClose( nFile2 )
FClose( nFile3 )
//Sleep(1000)
TarCompress( aFiles, cTarFile)
GZCompress( cTarFile, cTarGzFile)
FErase(cFile1)
FErase(cFile2)
FErase(cFile3)
FErase(cTarFile)
FErase(cTarGzFile)
Next nX
DirRemove( cCurDir + cTmpDir )
Return
Static Function printf(cLog)
Return conout("["+time()+" - "+cValToChar(ThreadId())+"] " + cLog)
@vitorebatista
Copy link
Author

O erro gerado é:

[INFO ][SERVER] [09/07/2018 11:31:32] Starting Program U_TESTTARTHREAD Thread 14808 (maria.elisandra,NG041-PC)
[11:31:32 - 13984] 1

[INFO ][SERVER] [Thread 14808] [09/07/2018 11:31:33] Thread finished (maria.elisandra, NG041-PC) 
[11:31:33 - 16232] 1
[11:31:33 - 13984] 2
[11:31:33 - 16232] 2
[11:31:33 - 13984] 3
[11:31:33 - 16232] 3
[11:31:33 - 16232] 4
//=====================================================


Thread 13984


Exception code: C0000005 ACCESS_VIOLATION


Fault address:  00FB2D20 01:00BB1D20 F:\TOTVS\Protheus\bin\appserver\AppServer.exe


[11:31:33 - 16232] 5


Stack Trace:



Address   Frame


00FB2D20  00000000  
unqlite_compile_file+10A00
	Unable to locate source line number


00FB2D20  00000000  
unqlite_compile_file+10A00
	Unable to locate source line number


00FAFC04  00000000  
unqlite_compile_file+D8E4
	Unable to locate source line number


00FA91A5  00000000  
unqlite_compile_file+6E85
	Unable to locate source line number





[11:31:33 - 16232] 6
[11:31:33 - 16232] 7
[11:31:33 - 16232] 8
[11:31:33 - 16232] 9
[11:31:33 - 16232] 10
[11:31:33 - 16232] 11
[11:31:33 - 16232] 12
[11:31:33 - 16232] 13
[11:31:33 - 16232] 14
[11:31:33 - 16232] 15
[11:31:33 - 16232] 16
[11:31:33 - 16232] 17
[11:31:34 - 16232] 18
[11:31:34 - 16232] 19
[11:31:34 - 16232] 20
[11:31:34 - 16232] 21
[11:31:34 - 16232] 22
[11:31:34 - 16232] 23
[11:31:34 - 16232] 24
[11:31:34 - 16232] 25
[11:31:34 - 16232] 26
[11:31:34 - 16232] 27
[11:31:34 - 16232] 28
[11:31:34 - 16232] 29
[11:31:34 - 16232] 30
[11:31:34 - 16232] 31
[11:31:34 - 16232] 32
[11:31:34 - 16232] 33
[11:31:34 - 16232] 34
[11:31:34 - 16232] 35
[11:31:34 - 16232] 36
[11:31:35 - 16232] 37
[11:31:35 - 16232] 38
[11:31:35 - 16232] 39
[11:31:35 - 16232] 40
[11:31:35 - 16232] 41
[11:31:35 - 16232] 42
[11:31:35 - 16232] 43
[11:31:35 - 16232] 44
[11:31:35 - 16232] 45
[11:31:35 - 16232] 46
[11:31:35 - 16232] 47
[11:31:35 - 16232] 48
[11:31:35 - 16232] 49
[11:31:35 - 16232] 50
[11:31:35 - 16232] 51
[11:31:35 - 16232] 52
[11:31:35 - 16232] 53
[11:31:35 - 16232] 54
[11:31:35 - 16232] 55
[11:31:36 - 16232] 56
[11:31:36 - 16232] 57
[11:31:36 - 16232] 58
[11:31:36 - 16232] 59
[11:31:36 - 16232] 60
[11:31:36 - 16232] 61
[11:31:36 - 16232] 62
[11:31:36 - 16232] 63
[11:31:36 - 16232] 64
[11:31:36 - 16232] 65
[11:31:36 - 16232] 66
[11:31:36 - 16232] 67
[11:31:36 - 16232] 68
[11:31:36 - 16232] 69
[11:31:36 - 16232] 70
[11:31:36 - 16232] 71
[11:31:36 - 16232] 72
[11:31:36 - 16232] 73
[11:31:37 - 16232] 74
[11:31:37 - 16232] 75
[11:31:37 - 16232] 76
[11:31:37 - 16232] 77
[11:31:37 - 16232] 78
[11:31:37 - 16232] 79
[11:31:37 - 16232] 80
[11:31:37 - 16232] 81
[11:31:37 - 16232] 82
[11:31:37 - 16232] 83
[11:31:37 - 16232] 84
[11:31:37 - 16232] 85
[11:31:37 - 16232] 86
[11:31:37 - 16232] 87
[11:31:37 - 16232] 88
[11:31:37 - 16232] 89
[11:31:37 - 16232] 90
[11:31:37 - 16232] 91
[11:31:37 - 16232] 92
[11:31:37 - 16232] 93
[11:31:38 - 16232] 94
[11:31:38 - 16232] 95
[11:31:38 - 16232] 96
[11:31:38 - 16232] 97
[11:31:38 - 16232] 98
[11:31:38 - 16232] 99
[11:31:38 - 16232] 100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment