#1 2022-01-06 03:11:01

wxinix
Member
Registered: 2020-09-07
Posts: 121

Program Hangs:TSqlDBConnectionProperties.ExecuteNoResult never returns

This used to work, but it fails my unit testing today - so I guess this is some newly introduced bug.

When calling ExecuteNoResult,  it never returns.

Tracing the code,  it seems the program hangs at mormot.db.sql,  line 3492, TSqlDBConnectionProperties.NewThreadSafeStatementPrepared

function TSqlDBConnectionProperties.NewThreadSafeStatementPrepared(const aSql:
  RawUtf8; ExpectResults, RaiseExceptionOnError: boolean): ISqlDBStatement;
begin
  result := ThreadSafeConnection.NewStatementPrepared(aSql, ExpectResults,
    RaiseExceptionOnError);
end;

Any advice? Seems like a new bug, or something that breaking changes for the existing code?

Last edited by wxinix (2022-01-06 03:12:01)

Offline

#2 2022-01-06 07:57:53

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

Re: Program Hangs:TSqlDBConnectionProperties.ExecuteNoResult never returns

I don't remember changing anything at that level.

With with DB and TSqlDBConnectionProperties class and compiler?

Where does it hang exactly (within ThreadSafeConnection or within NewStatementPrepared)? Could you debug a little?

Edit: perhaps it is about the new TRWLightLock use in SqlDBConnectionPropertiesThreadSafe.ThreadSafeConnection.
But I am not able to reproduce the issue.

Offline

#3 2022-01-06 13:15:03

wxinix
Member
Registered: 2020-09-07
Posts: 121

Re: Program Hangs:TSqlDBConnectionProperties.ExecuteNoResult never returns

Thank you.

I downloaded latest commit as of 8:11am, Jan 6, 2022 (Eastern Time).  This seems to fix the "hanging problem" of the unit test case (as reported above), and that test case was able to pass.

But then, another test case fails, at mormot.core.json, line 3196-3236, function GotoEndJsonItemString(P: PUtf8Char): PUtf8Char;

it hangs inside that function, and was never able to return.

The following is the call stack:

mormot.core.json.GotoEndJsonItemString
mormot.orm.core.TOrmTableJson.ParseAndConvert
mormot.orm.core.TOrmTableJson.CreateFromTables
mormot.orm.storage.TRestStorageInMemory.LoadFromJson
mormot.orm.storage.TRestStorageInMemory.ReloadFromFile
mormot.orm.storage.TRestStorageInMemory.Create
...

Any thoughts?

Last edited by wxinix (2022-01-06 13:29:54)

Offline

#4 2022-01-06 14:59:37

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

Re: Program Hangs:TSqlDBConnectionProperties.ExecuteNoResult never returns

What is the JSON input in the function?

Please try https://github.com/synopse/mORMot2/commit/3253bf05

Offline

#5 2022-01-06 15:02:33

wxinix
Member
Registered: 2020-09-07
Posts: 121

Re: Program Hangs:TSqlDBConnectionProperties.ExecuteNoResult never returns

I think there is a bug with function GotoEndJsonItemString(P: PUtf8Char): PUtf8Char;

Line 3231, mormot.core.json:

     else if P^ = #0 then
        break
      else if P^ <= ' ' then
        continue;   // <== once the loop end up in this branch,  the loop will never be able to break, because P stops increment!!

Last edited by wxinix (2022-01-06 15:04:57)

Offline

#6 2022-01-06 15:09:39

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

Re: Program Hangs:TSqlDBConnectionProperties.ExecuteNoResult never returns

Offline

#7 2022-01-06 15:17:18

wxinix
Member
Registered: 2020-09-07
Posts: 121

Re: Program Hangs:TSqlDBConnectionProperties.ExecuteNoResult never returns

That fixed it.

Thank you.

Offline

Board footer

Powered by FluxBB