You are not logged in.
Pages: 1
Thanks for your input. I will post the result for the science.
Good to hear that.
It was an instance of a bidir TWebSocketAsyncServerRest. I will recompile the project next week and upload all the test clients while keeping the server running in the debugger.
@ColdZer0, is everything still ok?
This is what happens after 14 hours, plus the console is not updating anymore.
I am asking because i ran into the same issue in the end of july while testing the new async server, and I want to give another try. I had no junk network traffic as the network is filtered only on known static ips but almost all clients are connecting through 4G routers with sometime high latency and/or random disconnections. The console was "stuck" after ~6h with around 170 clients sending 1 or more requests per secs.
Thanks you both for the debugging and fixes
FPC => OK
On Delphi 11, after adding ISDELPHI11 directive on top, cleaning dcu, it's OK.
Hi,
it seem that OnWebSocketsClosed is not triggered on client side when compiled with last mORMo2 version.
I have the issue on Delphi 11, still not tested on FPC. I tested it with `rest-websockets` project from the example folder, compiling the server and client on a fresh clone.
You can find the client code with `OnWebSocketsClosed` implemented there:
https://gist.github.com/flydev-fr/93902 … a488e1edae
When compiling only the client with mORMot2 (commit fa3cd43097e1e9a89edee94ad0282b17817668a6 from May 12) I can get it working.
Hi @ab,
Replying here about the issue #183 reported on Github - your commit (38f27f08) fixed the / or - exception.
(Sorry for the time lost about the PR, I feel learning more by doing mistake and trying to fix things, to be honest, I had a doubt it was the right correction as you confirmed it on the PR comment that is making sense, lesson learned )
Hi @ab,
I was looking for infos on the forum from my mobile, I must admit it was not easy
You might consider testing an update of the air theme and just adding this single line on the main html file/tpl
<meta name="viewport" content="width=device-width, initial-scale=1.0">
css: https://github.com/natrius/air3/blob/master/Air3.css
Preview Result:
home:
list of threads:
thread content:
And if you want/need some assist to make and validating it on a staging server, I am ok to do it
i edited my last post @missionhq, I confirm the bug at least on 11.2.
Could you confirm you're using the older ver of mormot (before ab's fix)
Yes, the version was from the commits of Nov 22, 2022. Even with Debug/O+, no exception.
@missionhq: did a reset, cloned from commit 74cfbc4 then with debug O+ the exception is triggered on delphi 11.2, I will try when I am back on 11.0 and 11.1.
EAccessViolation: Access violation at address 00941F00 in module 'Project01.exe'. Read of address 076F5980
I tested your sample and I could not reproduce that in 11.0, 11.1 and 11.2, debug or release mode, in 32bit or 64bit. No exception, and element popped.
=> mormot v1 & v2..
Hi, you can take a look there for example (v1, it's easy to port on v2), and in the source of `mormot.crypt.core` for more details (read the comments).
You can also find more recents details on a good blog post .
I just tested the application, your examples really make things easier and give a lot of good implementation ideas, thanks you @tbo
Thanks @ab
Hi,
I had a chunk of code that was calling `Client.TimerEnable` found on this thread made by @tbo (https://synopse.info/forum/viewtopic.ph … 681#p33681)
But after upgrading some weeks ago mORMot, i get the following error:
[dcc32 Error] frmMain.pas(255): E2009 Incompatible types: 'Parameter lists differ'
I see the that the signature defined in `mormot.rest.core` is the following now:
function TRest.TimerEnable(const aOnProcess: TOnSynBackgroundTimerProcess; aOnProcessSecs: cardinal): TRestBackgroundTimer;
And my code was:
frmMain.Connect(pmSender: TSynBackgroundTimer; pmEvent: TWaitResult; const pmcMsg: RawUTF8);
I can't manage to get my brain getting the right call even after reading all the code comments
can someone you give me a hint please ?
I didn't think about that at all. Thanks you ! Will share the result / solution
BTW PostgreSQL on Windows works extremely bad - it designed for Linux
Thanks for insight, indeed, I am migrating the infrastructure on Unix server as Windows Server only bring me problems, especially with database servers.
@daniel thanks, indeed the executable is compiled in 64bit. I double checked with a PE tool after compilation.
I must add FYI, that I tried to load the lib with this simple call
var Handle := LoadLibrary('libpq.dll');
if Handle <> 0 then
WriteLn('OK')
else
WriteLn('BAD');
and it return 'BAD'
with the env PATH modified, it return 'OK'.
I also read the whole following thread found on Lazarus forum: https://forum.lazarus.freepascal.org/in … 4cpaer7mh3
I will come back for sure to this issue as the solution to modify the ENV path like in my first message is only viable for my local dev environment.
Hi,
I'am scratching my head with this.
ESqlDBPostgres {Message:"TSqlDBPostgresLib.TryLoadLibray failed - searched in C:\\Users\\flydev\\Documents\\Embarcadero\\Studio\\Projets\\SagasEnv\\RemoteBlock2\\bin2\\libpq.dll, libpq.dll",Statement:null}
I installed Postgres 14, copied the libs (crypto, iconv, libintl, libssl, zlib and libpq.dll) in the same directory of the executable, I tried to add as well this dir on env PATH, but nothing.
Is there something special to do ?
---
Edit: Just added `C:\Program Files\PostgreSQL\14\bin` to the env PATH and it's working..
Nice serie ! Keep up the good work Thomas
Hi @ab, just sponsored Synopse, and I left a sponsorship suggestion to the company in the preamble of the documentation, and by direct mail as well.
Doing war with guns and missiles in 2022.. Please stay safe mpv ... I also have a thought for the russian people who don't agree... I was going to ask help about a programming thing but after reading this thread I'm going to get some sleep... what a madness
True, and so, with the documentation chapter #13.2, the #6.2.4 sentence and the following blogpost, the road should be shorter:
Sorry to write on a suck ten years old thread, but it will be easier to me to stumb on again, and i think it should pinned
Reading it again made me realized I took a bad direction on a feature of the software I am working on, even if I read ten times the doc since my first mORMot introduction.
Ok, back from resto, I cloned mORMot2-3.35.5, compiled the project, and everything is working as expected.
Then I switched to mORMot-3.36.0, compiled the project, and it works as expected too ... externals tables are created.
So everything is working, sorry this post.. if someone has a hint on what could be happening.. like a MySQL cache "issue" or something do not hesitate to write a comments. Thanks.
PS: The only things I didn't tested it's to restart the database server.
I think I am doing things as it should. To be honest, I just pulled mORMot2 and compiled.
Model:
function DataModel: TOrmModel;
begin
Result := TOrmModel.Create([
TOrmLprPlateRawData
], ROOT_NAME);
end;
Server Initialization:
// get the shared data model
fModel := DataModel;
// use external database for all tables
VirtualTableExternalRegisterAll(fModel, fProps);
// create the main mORMot server with authentication required
fRestServer := TRestServerDB.Create(fModel, 'vremotesagas.db', true);
fHttpServer := TSQLHTTPServer.Create(PORT_NAME, [fRestServer], SERVER_URL, useBidirSocket, 32, secNone);
fHttpServer.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries
// create tables or fields if missing
fRestServer.CreateMissingTables;
PS: To explain the different table name between the two version, I renamed it on new version.
Edit:
Pastebin of the full start log of the server : https://pastebin.com/jSgCvjWR
Hi,
I updated my project to the latest mORMot2 with SQLite static libs 3.36 and the latest Zeos lib and it look like that External Tables are not created anymore, it's possible that I missed something between two updates of the framework, I didn't saw a note about that.
With VERBOSE logs enabled, when the server start (CreateMissingTable log line reduced) :
> Old version :
[...]
20210913 11135418 DB mormot.orm.sqlite3.TRestOrmServerDB(02de2b80) CreateMissingTables on {"TSqlDatabase(0378b490)"}
20210913 11135418 DB mormot.orm.sqlite3.TRestOrmServerDB(02de2b80) GetTables=["AuthGroup","AuthUser","PlateRawData"]
20210913 11135418 + mormot.orm.sql.TRestStorageExternal(0344a720).Create TOrmPlateRawData
20210913 11135418 info mormot.orm.sql.TRestStorageExternal(0344a720) TOrmPlateRawData as PlateRawData {"TSqlDBZeosConnectionProperties(02d54ec0)":
{Engine:"SqlDBZeos",ServerName:"localhost",DatabaseNameSafe:"remotesagas",UserID:"foobar",Dbms:"dMySQL",DbmsEngineName:"MySQL",BatchSendingAbilities:["cCreate"],BatchMaxSentAtOnce:4096,LoggedSqlMaxSize:2048,UseCache:true,StatementMaxMemory:536870912,RollbackOnDisconnect:true,DateTimeFirstChar:84,DBMSName:"mysql"}}
Server={"TRestOrmServerDB(02de2b80)":{StaticVirtualTableDirect:true,DB:{"TSqlDatabase(0378b490)":
{FileName:"vremotesagas.db",UseCache:true,UseCacheSize:16777216,CacheSize:10000,PageSize:4096,PageCount:22,FileSize:90112,Synchronous:"smFull",LockingMode:"lmNormal",OpenV2Flags:6,SQLite3Library:{"TSqlite3LibraryStatic(02d833a0)":{Version:"TSqlite3LibraryStatic 3.35.5 with internal MM"}}}}}}
[...]
20210913 11135419 + mormot.db.sql.zeos TSqlDBZeosStatement.Step (1203)
Server is now running on mykingspark.fr:61337/root
> New Version
20210913 11130122 SQL mormot.db.raw.sqlite3.TSqlDatabase(035fce30) 206us vremotesagas.db returned 14 rows SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%';
20210913 11130122 DB mormot.orm.sqlite3.TRestOrmServerDB(02e32040) CreateMissingTables on {"TSqlDatabase(035fce30)"}
20210913 11130122 DB mormot.orm.sqlite3.TRestOrmServerDB(02e32040) GetTables=["AuthGroup","AuthUser","LprPlateRawData"]
20210913 11130122 SQL mormot.db.raw.sqlite3.TSqlDatabase(035fce30) 4us vremotesagas.db PRAGMA locking_mode=NORMAL; = true
20210913 11130122 - 00.000.278
20210913 11130124 info Server is now running on localhost:61337/root
There is no errors in logs.
Statement "mormot.orm.sql.TRestStorageExternal(0344a720).Create TOrmPlateRawData" is missing on the log on new version.
Statement "mormot.db.sql.zeos TSqlDBZeosStatement.Step" is missing on the log on new version.
Any hint ?
Ok thanks - your comment make things clearer.
I didn't checked my code source right now but I don't remember to have changed something after my own post, but opening the same db while reading your post :
I will check if I changed something and will report here
PS: I dont mean there is a bug in mormot2, I am just trying to understand what's is going
Hello,
Just to be clear, the project works - everything is fine.
I am used to explore the SQLIte database with SQLiteSpy, but this morning after an update of my mORMotClient unit and a compilation, when I open the DB with the tool (same with HeidiSQL) I have theses error, check the screenshot :
Sorry to post that, I dont want to scracth my head for hours trying to understand the error - any idea guys ?
Yes, you must use
TDocVariantData.Names._Count - 1
Only TTaskDialog
And `mORMotUIEdit (mORMotUI*)` could be cool too
But I do have a question - it seems that TSynLog cannot capture the StackOverFlow exception that happened in a background thread?
This might be due to OTL. Read this sentence about Exception notifications: http://www.omnithreadlibrary.com/book/chap14.html - then you can try to call your ILog.Log() mecanism inside your exception filter.
Just in case, read @ab's and @mpv's comment there : https://synopse.info/forum/viewtopic.php?id=5793
I have also more than 80 clients with servers in production (on mormot v2 now) and no TSynLog issue since months. I can remember having issue with TSynLog but it was my learning curve that was not completed, and the issue was introduced by me, it was also a bit hard to spot as I am mixing mORMot2 and OmniThreadLibrary.
Thanks @ab, effectively, this is something I didn't think of.
Hi everyone,
I am maybe starting a dumb question, it's possible to have a TSQLHTTPServer running with useBidirSocket and secSsl ?
I am trying to upgrade a current project to use SSL because I have a ServiceMethod which return HTML content with some javascript. In this javascript code, I call the WebAPI "navigator.share" which only works on secure (HTTPS) domains.
So I created a self-signed certificate, registered the route, everything good at this point, I can browse the document on HTTPS and execute the javascript code.
The server answer some interface services, and send push notification through websockets, but to get HTTPS working, I had to change "useBiDirSocket" to "useHttpApiRegisteringURI" to the server declaration, but after this change, I am out of WebSockets support :
fRestServer := TRestServerDB.Create(fModel, 'vremotesagas.db', true);
fHttpServer := TSQLHTTPServer.Create(PORT_NAME, [fRestServer], SERVER_URL, useHttpApiRegisteringURI, 32, secSsl); // initially set with useBidirSocket and secNone
// fHttpServer.WebSocketsEnable(fRestServer, SAGAS_TRANSMISSION_KEY);//.Settings.ClientAutoUpgrade := true;
If I set "useBiDirSocket" with "secSsl" and try to browse a document on HTTPS, i get an AV on "mormot.rest.http.server" line 1020 :
// call matching TRestServer.Uri()
call.Method := Ctxt.Method;
call.InHead := Ctxt.InHeaders;
call.InBody := Ctxt.InContent;
serv.Uri(call); <------------------- serv is nil
Ok, thanks @ab
Hi,
Is there a project sample somewhere ? if not maybe someone have one helloworld project to share on Github ?
So the problem should be elsewhere.
Look like in Zeoslib, see comment on line 4640 of the file "ZDbcMetadata.pas" (zeoslib 7.2.10):
{**
Set the Wildcards character for WildcardsArray variable.
Overrride this method if the wildcards character is different in other database
}
procedure TZAbstractDatabaseMetadata.FillWildcards;
begin
SetLength(WildcardsArray,2);
WildcardsArray[0]:='_'; //<---- seems to be a trublemaker, no idea how to test it with our tests. See http://zeoslib.sourceforge.net/viewtopic.php?f=40&t=13184
WildcardsArray[1]:='%';
end;
If you read the post following the link, you will find a workarround and a discussion there: https://zeoslib.sourceforge.io/viewtopi … 2&p=160450
Okay, tried with your sample and I can confirm then.
Just to say that it works on my side on Delphi 10.4.2 pro.
The only things I have to fix afterward, it's the included units (still generate "unit uses" from mORMot v1) :
uses
SynCommons,
mORMot;
and to comment the TTextWriter initialization :
// TTextWriter.RegisterCustomJSONSerializerFromText
[...]
Compiled / run successfully on Delphi Sydney 10.4.2 Thanks for QuickJS
Just a small question to be sure, as the last post here is from 2017, the EWB book 2nd edition is about mORMot too, right ?
Oke @ab, thanks you.
Downloading the source and the static files version 3.34.1 from there : https://github.com/synopse/mORMot2/releases
ask for the 3.34.0 static files when running an executable, is this expected ?
Currently for Windows instances we always create a copy of a active log file before opening it in LogView to prevent such unexpected errors
Thanks you @mpv, that's what I ended doing
Thanks for the hint @ab, I reproduced it, in fact, I was opening the log file with the LogViewer while the soft was running.
Hello all,
Two hours ago I suffered a "crash" and I am trying to find the culprit (me for sure ) as I am quite new to this framework.
Note: It is possible that timeout are misconfigured and that I misunderstand the flow of the session expiration/client re-connection even if everything can run a week without any error or interruption
The setup is the following:
- Clients and server are built on mORMot2
- a database server (MariaDB 10) on a Windows server
- the (mORMot) server is an instance of TSQLHttpServer and hosted on the same computer as the database server
- the (mORMot) clients (~83 in the wild) are instance of TRestHttpClient and run on Windows 7 embedded
----------------
Server definition and timeout (maybe wrong and I should set it to a greather value) :
constructor TSagasServer.Create(Props: TSQLDBZEOSConnectionProperties);
var
Conn: TSQLDBConnection;
begin
fProps := Props;
fProps.ConnectionTimeOutMinutes := 1;
[...]
end;
Client definition and timeout (3000 ms)
fClient := TRestHttpClient.Create(AnsiString(SERVER_URL), PORT_NAME, fModel, false, '', '', 3000, 3000, 3000);
----------------
Suddenly, all the clients (~83) disconnected at the same time (by timeout ? from what I see in the client logs) :
> 16/03/2021 08:55:00.496 Exception EWinHttp {Message:"winhttp.dll error 2EE2 (timeout)"} [] at 6af783 stack trace API (TZOracleConnection.PingServer)
And on the server side, 15 seconds before (at 08:54:46) :
> 3/16/2021 08:54:45.944 Enter mormot.rest.sqlite3.TRestServerDB(02b56e10).URI PUT root/Capteurs/10?session_signature=258902d3016d2b0916971c8c in=464 B
> 3/16/2021 08:54:45.944 User auth mormot.rest.server.TRestServerRoutingRest(0308cba0) kingspark/629736147 1.2.3.4
> 3/16/2021 08:54:45.944 SQL mormot.db.sql.zeos.TSqlDBZEOSStatement(02b76530) ExecutePrepared 1.42ms wr=1 update Capteurs set NumeroConcessionnaire=0,NumeroParking=15,NumeroBorne=1,Etat_Monetique=0,Etat_CB=0,Etat_Imp_Sortie=0,Etat_Imp_Sortie_Papier=0,Etat_Imp_Sortie_Papier_Low=0,Etat_Laser_Entree=1,Etat_Laser_Sortie=0,Etat_Imp_Entree=1,Etat_Imp_Entree_Papier=0,Etat_Imp_Entree_Papier_Low=0,Barriere_Entree_Open=0,Barriere_Sortie_Open=0,Type_SIP=0,Etat_Connexion_SIP=0,WatchDog=0,WatchDog_UserStop=0,Update_time='2021-03-16 08:54:36',Site_Link=0 where ID=10
> 3/16/2021 08:54:45.944 Server kingspark 1.2.3.4 PUT root/Capteurs Write=200 out=0 B in 1.56ms
> 3/16/2021 08:54:45.944 Leave 00.001.574
> 3/16/2021 08:54:46.240 Enter mormot.rest.sqlite3.TRestServerDB(02b56e10).URI POST root/UpdateService.Get?session_signature=258902850056589b9976698e in=46 B
> 3/16/2021 08:54:46.240 User auth mormot.rest.server.TRestServerRoutingRest(0308cba0) kingspark/629736069 1.2.3.4
> 3/16/2021 08:54:46.240 Service call mormot.rest.sqlite3.TRestServerDB(02b56e10) IUpdateService.Get[{numeroParking:15,numeroBorne:3,typeBorne:1}]
> 3/16/2021 08:54:46.288 New run ==================================================
3/16/2021 08:54:52.208 Exception EHttpApiServer {LastError:1229,LastApi:"hSendHttpResponse"} [HttpSvr 61337 root THttpApiSvr] at 6c3aa7
About this last error exception, I read on this forum that it could be a timeout misconfiguration..
And the really strange part (to me) is the "New Run" event which poped multiple times each 100ms on the server side - I don't really know at this time what this mean.. please see the following pastebin log file :
> https://pastebin.com/9ZL8ndxj
----------------
To get back running everything, I paniked and restarted the server manualy, the first time I was still getting the execption ERROR_CONNECTION_INVALID.
Any hint please ? What I can/should add to this post so it will be more clear to you and easier to help ?
Thanks yo guys, have a nice day.
Note that the ORM with external DB has not be fully validated yet.
Feedback is welcome, because it is hard to validate on all DB/Library/OS combinations out there...
Thanks @ab,
I will test with external db and I will report it.
Awesome, does it mean I can clone the project and recompile my fresh project under mORMot 2 ?
Ok I understand much better. I know it's not ready for production, I am testing it and preparing myself for the release, as well contributing by reporting bugs.
Thanks Arnaud for the answer and again for the work put in Mormot.
Hello,
I am new here and I adopted a Mormot v1 some weeks ago and I must say that I am astonished by the strength and the simplicity of the framework
I started to port a - still small - project to Mormot v2 and I ran into an AV when running the program (quite simple), it look like it's related to Zeos and not Mormot but as I am a beginner with Mormot I prefer to ask/post first here.
My setup :
- fresh Delphi Sydney 10.4.1 install (tested on earlier version 10.4 and found a post here in this forum about a compiler bug reported which should have been fixed in 10.4.1)
- fresh clone of mormot2
- latest ZeosLib 7.2.8 (also tested old version)
I can compile and run the test without any issue. But once I try to use external MariaDB database with ZeosLib (it works fine with Mormot v1 and Zeos 7.2.8)
So starting with the following code :
begin
var
Props: TSQLDBZEOSConnectionProperties;
aPassword: RawUTF8; // aPassword is set on command line
Props := TSQLDBZEOSConnectionProperties.Create(RawUTF8('zdbc:mysql://localhost:3306/mydatabase?username=mylogin;password=' + aPassword), 'mydatabase', 'mylogin', aPassword);
[...]
end;
It compile fine, but when running the program crash there :
procedure ClassToText(C: TClass; var result: RawUTF8);
var
P: PShortString;
begin
if C = nil then
result := ''
else
begin
P := PPointer(PtrInt(PtrUInt(C)) + vmtClassName)^;
FastSetString(result, @P^[1], ord(P^[0])); ❌
end;
end;
The call stack :
Any hint ?
Thanks Arnaud and all contributors for this framework
Pages: 1