TWebbroker server has trouble waking up after a long night (Connect Closed Gracefully)

30 Views Asked by At

I know that I'm going to do a poor job describing this issue. But I have noticed this occurring several times now (by accident). While working on my TWebbroker Standalone application, I sometimes forget and leave it running in the Delphi debugger over night. It is usually because I fell down a rabbithole with some HTML/CS/JS issue late at night, or my OCD just wouldn't let me leave something that isn't pixel f-ing perfect alone while I work on the critical code. Anyway, when I come back in the morning and refresh my browser (localhost), all I see is "200 OK". For several refreshes, just "200 OK".

The first time this happened, I restarted the application and all was well. But it happened again this morning. So, without a full cup of coffee yet, I tried debugging a few requests. The exception being thrown was in the TidThread.Execute.Run (Connection Closed Gracefully). But after, about 3 or 4 page requests (about right when I thought I had the correct breakpoints in place) the pages started loading fine. The issue resolved itself either due to several page retries or the act of debugging.

I was able to determine that the error was occurring after the FireDac database connection to a AWS RDS MySql server was made and the first query was being executed. TFDQuery.Active := True; I'm seeking suggestions on where to look to figure out why this is occurring.

I'm using pooled connections:

Params.Add('Server='+Settings.Values['DB_SERVER']);
Params.Add('Database='+Settings.Values['DB_CATALOG']);
Params.Add('User_Name='+Settings.Values['DB_USER']);
Params.Add('Password='+Settings.Values['DB_PASSWORD']);
Params.Add('Pooled=True');
Params.Add('POOL_CleanupTimeout=300000');
Params.Add('POOL_ExpireTimeout=600000');
Params.Add('POOL_MaximumItems=100');
FDManager.AddConnectionDef('FirePool','MySQL',Params);

I know there is not much to go on, but hopefully this may ring a bell with someone that could shed some light. In the meantime, I'll see what happens in the morning. Now, back to that CSS thing...

Restart works. Multiple retries with debugger breakpoint work. Coffee.

0

There are 0 best solutions below