Bash의 기본 작업에 대한 무작위 시간 초과

Bash의 기본 작업에 대한 무작위 시간 초과

문맥

Linux 시스템에서 GitHub Action이 실행되고 있습니다.

다음 작업을 수행합니다(대부분 관련이 없을 수 있으므로 먼저 질문으로 건너뛰고 싶을 수도 있습니다.):

  1. pwd:/home/runner/work/net.twisterrob.cinema/net.twisterrob.cinema
  2. zip을 다운로드하고 다음 위치에 압축을 푼다.diff/prev
  3. zip을 다운로드하고 다음 위치에 압축을 푼다.diff/curr
  4. 다른 모든 것은 diff폴더 내에서 실행됩니다.
  5. prev다음 과 같이 내부 파일 쌍에 대해 diff를 실행합니다 curr.
    diff --unified=3 --new-file --text --minimal "prev/backend.lockfile" "curr/backend.lockfile" > "backend.lockfile.diff"
    
  6. 다른 파일에 대해 다른 다른 diff 세트를 실행하십시오.
    ./dependency-tree-diff.jar "prev/$1.dependencies" "curr/$1.dependencies" > "$1.dependencies.diff"
    
  7. 쉘 스크립트를 통해 diff를 패치로 변환합니다.
    ./dependency-tree-diff-to-patch.sh "$1.dependencies.diff" "${BASE}" "${HEAD}" > "$1.dependencies.patch"
    
  8. 마지막으로 디렉터리 내용은 다음과 같습니다.ls -la
    total 272
    drwxr-xr-x  4 runner docker  4096 Jan 27 21:13 .
    drwxr-xr-x 12 runner docker  4096 Jan 27 21:12 ..
    -rw-r--r--  1 runner docker 32293 Jan 27 21:13 backend-database.dependencies.diff
    -rw-r--r--  1 runner docker 32784 Jan 27 21:13 backend-database.dependencies.patch
    -rw-r--r--  1 runner docker  4250 Jan 27 21:13 backend-database.lockfile.diff
    -rw-r--r--  1 runner docker     2 Jan 27 21:13 backend-database.lockfile.diff.error
    -rw-r--r--  1 runner docker 14853 Jan 27 21:13 backend-endpoint.dependencies.diff
    -rw-r--r--  1 runner docker 15322 Jan 27 21:13 backend-endpoint.dependencies.patch
    -rw-r--r--  1 runner docker  4202 Jan 27 21:13 backend-endpoint.lockfile.diff
    -rw-r--r--  1 runner docker     2 Jan 27 21:13 backend-endpoint.lockfile.diff.error
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 backend-feed.dependencies.diff
    -rw-r--r--  1 runner docker   426 Jan 27 21:13 backend-feed.dependencies.patch
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 backend-feed.lockfile.diff
    -rw-r--r--  1 runner docker     2 Jan 27 21:13 backend-feed.lockfile.diff.error
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 backend-network.dependencies.diff
    -rw-r--r--  1 runner docker   438 Jan 27 21:13 backend-network.dependencies.patch
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 backend-network.lockfile.diff
    -rw-r--r--  1 runner docker     2 Jan 27 21:13 backend-network.lockfile.diff.error
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 backend-quickbook.dependencies.diff
    -rw-r--r--  1 runner docker   446 Jan 27 21:13 backend-quickbook.dependencies.patch
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 backend-quickbook.lockfile.diff
    -rw-r--r--  1 runner docker     2 Jan 27 21:13 backend-quickbook.lockfile.diff.error
    -rw-r--r--  1 runner docker 13691 Jan 27 21:13 backend-sync.dependencies.diff
    -rw-r--r--  1 runner docker 14141 Jan 27 21:13 backend-sync.dependencies.patch
    -rw-r--r--  1 runner docker  3869 Jan 27 21:13 backend-sync.lockfile.diff
    -rw-r--r--  1 runner docker     2 Jan 27 21:13 backend-sync.lockfile.diff.error
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 backend.dependencies.diff
    -rw-r--r--  1 runner docker   406 Jan 27 21:13 backend.dependencies.patch
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 backend.lockfile.diff
    -rw-r--r--  1 runner docker     2 Jan 27 21:13 backend.lockfile.diff.error
    drwxr-xr-x  2 runner docker  4096 Jan 27 21:12 curr
    -rwxr-xr-x  1 runner docker   441 Jan 27 21:13 dependency-tree-diff-to-patch.sh
    -rwxr-xr-x  1 runner docker 20979 Jun 17  2022 dependency-tree-diff.jar
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 plugins-settings.lockfile.diff
    -rw-r--r--  1 runner docker     2 Jan 27 21:13 plugins-settings.lockfile.diff.error
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 plugins.dependencies.diff
    -rw-r--r--  1 runner docker   406 Jan 27 21:13 plugins.dependencies.patch
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 plugins.lockfile.diff
    -rw-r--r--  1 runner docker     2 Jan 27 21:13 plugins.lockfile.diff.error
    drwxr-xr-x  2 runner docker  4096 Jan 27 21:12 prev
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 root-settings.lockfile.diff
    -rw-r--r--  1 runner docker     2 Jan 27 21:13 root-settings.lockfile.diff.error
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 root.dependencies.diff
    -rw-r--r--  1 runner docker   394 Jan 27 21:13 root.dependencies.patch
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 root.lockfile.diff
    -rw-r--r--  1 runner docker     2 Jan 27 21:13 root.lockfile.diff.error
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 test-helpers.dependencies.diff
    -rw-r--r--  1 runner docker   426 Jan 27 21:13 test-helpers.dependencies.patch
    -rw-r--r--  1 runner docker     0 Jan 27 21:13 test-helpers.lockfile.diff
    -rw-r--r--  1 runner docker     2 Jan 27 21:13 test-helpers.lockfile.diff.error
    
  9. 폴더 크기를 더 잘 측정하려면 다음을 수행하세요.du -h -d 1
    2.3M    ./prev
    2.3M    ./curr
    4.8M    .
    
  10. 디스크 사용량:df
    Filesystem     1K-blocks     Used Available Use% Mounted on
    /dev/root       87204404 51329544  35858476  59% /
    tmpfs            3555312      172   3555140   1% /dev/shm
    tmpfs            1422128     1092   1421036   1% /run
    tmpfs               5120        0      5120   0% /run/lock
    /dev/sdb15        106858     5329    101529   5% /boot/efi
    /dev/sda1       14341128  4194336   9396508  31% /mnt
    tmpfs             711060       12    711048   1% /run/user/1001
    
  11. diff 파일을 하나의 파일로 병합
    ls --format=single-column --time=ctime --reverse *.dependencies.diff | xargs tail --lines=+1 > all.dependencies.diff
    

11단계의 목적은 cat *.dependencies.diff > all.dependencies.diff더 많은 제어(순서)와 보풀(제목)을 갖는 것입니다.https://stackoverflow.com/a/2817024+https://stackoverflow.com/a/7816490man ls+ 플래그를 사용하고 확장하세요 man tail.

문제 및 질문

마지막 11단계에서 시간이 초과되는 경우가 있습니다. 전체 GitHub Action의 제한 시간은 10분이며, 11단계는 일반적으로 9분이 소요되며 취소됩니다. 하지만항상 그런 것은 아니다, 일반적으로 "작동"합니다. All ls, dudf은 무슨 일이 일어나고 있는지 진단하기 위한 것입니다.누군가가 이 설정/스크립트/환경에서 완료되지 않을 수 있는 문제를 발견하기를 바라는 마음으로 이 글을 게시합니다.내 스크립트에서 오류를 배제하려고 합니다.

완전히 동일한 코드(변경된 사항 없음)에 대한 다양한 시나리오를 모두 보여주는 훌륭한 예가 있습니다.

시도 1: 실패https://github.com/TWiStErRob/net.twisterrob.cinema/actions/runs/4028195985/jobs/6924812632

시도 2: 실패https://github.com/TWiStErRob/net.twisterrob.cinema/actions/runs/4028195985/jobs/6925862191

시도 3: 성공 https://github.com/TWiStErRob/net.twisterrob.cinema/actions/runs/4028195985/jobs/6930610577

가장 이상한 점은 실패할 때 항상 "기기에 남은 공간이 없습니다"라는 메시지가 표시되고 항상 이 단계에 있다는 것입니다!

System.IO.IOException: No space left on device : '/home/runner/runners/2.301.1/_diag/Worker_20230127-210915-utc.log'
   at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle handle, ReadOnlySpan`1 buffer, Int64 fileOffset)
   at System.IO.Strategies.BufferedFileStreamStrategy.FlushWrite()
   at System.IO.Strategies.BufferedFileStreamStrategy.WriteSpan(ReadOnlySpan`1 source, ArraySegment`1 arraySegment)
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.Diagnostics.TextWriterTraceListener.Flush()
   at GitHub.Runner.Common.HostTraceListener.WriteHeader(String source, TraceEventType eventType, Int32 id)
   at GitHub.Runner.Common.HostTraceListener.TraceEvent(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, String message)
   at System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String message)
   at GitHub.Runner.Worker.Worker.RunAsync(String pipeIn, String pipeOut)
   at GitHub.Runner.Worker.Program.MainAsync(IHostContext context, String[] args)
System.IO.IOException: No space left on device : '/home/runner/runners/2.301.1/_diag/Worker_20230127-210915-utc.log'
   at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle handle, ReadOnlySpan`1 buffer, Int64 fileOffset)
   at System.IO.Strategies.BufferedFileStreamStrategy.FlushWrite()
   at System.IO.Strategies.BufferedFileStreamStrategy.WriteSpan(ReadOnlySpan`1 source, ArraySegment`1 arraySegment)
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.Diagnostics.TextWriterTraceListener.Flush()
   at GitHub.Runner.Common.HostTraceListener.WriteHeader(String source, TraceEventType eventType, Int32 id)
   at GitHub.Runner.Common.HostTraceListener.TraceEvent(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, String message)
   at System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String message)
   at GitHub.Runner.Common.Tracing.Error(Exception exception)
   at GitHub.Runner.Worker.Program.MainAsync(IHostContext context, String[] args)
Unhandled exception. System.IO.IOException: No space left on device : '/home/runner/runners/2.301.1/_diag/Worker_20230127-210915-utc.log'
   at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle handle, ReadOnlySpan`1 buffer, Int64 fileOffset)
   at System.IO.Strategies.BufferedFileStreamStrategy.FlushWrite()
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.Diagnostics.TextWriterTraceListener.Flush()
   at System.Diagnostics.TraceSource.Flush()
   at GitHub.Runner.Common.TraceManager.Dispose(Boolean disposing)
   at GitHub.Runner.Common.TraceManager.Dispose()
   at GitHub.Runner.Common.HostContext.Dispose(Boolean disposing)
   at GitHub.Runner.Common.HostContext.Dispose()
   at GitHub.Runner.Worker.Program.Main(String[] args)

관련 정보