#1 2024-11-16 09:05:53

songshuang
Member
From: changzhou,jiangsu,china
Registered: 2018-08-09
Posts: 20

Console project deadlock

hello!
I have a little console project rest server with mormot2,  it can be deadlock some times(no any response when client connecting), it is good when keying enter key,What could be the possible reason?
I make source to service project , It's well.
No any waiting a key in my source.
Mormot 2.3, Delphi12.2

Last edited by songshuang (2024-11-16 09:14:19)

Offline

#2 2024-11-16 09:14:53

flydev
Member
From: France
Registered: 2020-11-27
Posts: 73
Website

Re: Console project deadlock

hi, hard to say without more details.  Start by enabling log with LOG_VERBOSE level then check logs once it happen again.

Offline

#3 2024-11-18 00:26:55

songshuang
Member
From: changzhou,jiangsu,china
Registered: 2018-08-09
Posts: 20

Re: Console project deadlock

The above issues is well sometimes,sometimes occured.

  Writeln('hello word');
  myhttpsvr := TTmyServer.Create;
  try
    Writeln('Press enter to close');
    ConsoleWaitForEnterKey;
  finally
    Writeln('stopping...');
    FreeAndNil(myhttpsvr);
    Writeln('svr stoppeded.');
  end;

Sometimes showing

hello word
Press enter to close
...
20241118 08131854  +    mormot.db.raw.sqlite3.TSqlDatabase(e741f0).DBOpen SQLCY.db
...

Sometimes showing

...
20241118 08233147 http  mormot.rest.http.server.TRestHttpServer(02f2a2e0) http.sys registration of http://+:7302//
hello word
Press enter to close

so, I may have some understanding now

Offline

#4 2024-11-18 07:12:09

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Console project deadlock

Difficult to know what is wrong in your code.

Some ideas:
- First step is to move your startup code out of "Create" and put it into a dedicated method like "Run".
- Use a try..except and show any exception during this "Run" method call.

Offline

Board footer

Powered by FluxBB