impress icon indicating copy to clipboard operation
impress copied to clipboard

Uncaught exception during unlink log file

Open georgolden opened this issue 3 years ago • 4 comments

Describe the bug I had Metarhia from Example template running during the night. And server crushed with Uncaught exception.

To Reproduce Run server, run client in browser and wait a long time. I don't know how to reproduce it quickly. I need to inspect metalog.

Expected behavior There must be no uncaught exception on async operations like unlink file.

Screenshots Error:

node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

[Error: ENOENT: no such file or directory, unlink '/home/jebuscross/Example/log/2021-11-04-W0.log'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'unlink',
  path: '/home/jebuscross/Example/log/2021-11-04-W0.log'
}

Log file exists, and it is empty, as it should be. Last log file is 2021-11-04-W6.log

Desktop (please complete the following information):

  • OS: [Arch Linux 64-bit]
  • Node.js version [16.13.0]
  • Impress version [2.0.0]

Additional context I am almost 100 percent sure, that this bug connected to metalog only. But it affects impress application server - it can be issued here.

georgolden avatar Nov 04 '21 06:11 georgolden

I have an idea how to reproduce, at GMT 0 metalog closes old files and creates new. I will try @georgolden

tshemsedinov avatar Nov 05 '21 21:11 tshemsedinov

@tshemsedinov I started now server again hope that tomorrow morning I will see anything in logs, that I added inside metalog

georgolden avatar Nov 05 '21 22:11 georgolden

Localized: https://github.com/metarhia/metalog/blob/80386d29916bc79957640ea170da6c91d435bfb7/metalog.js#L297

tshemsedinov avatar Nov 06 '21 08:11 tshemsedinov

My server also crashes when a new day starts. I reproduced by changing the built-in Date class and setting at 23:59. It might be worth adding something like this to the "metatests" library for time sensitive cases.

Pom4H avatar Nov 14 '21 13:11 Pom4H

As of impress 3.0.1 everything works

tshemsedinov avatar Jul 31 '23 03:07 tshemsedinov