Hello, I am using an XData REST Server with services... and I'm really confused: with exactly the same code I get different results when calling complex stuff (several SQL queries even with for loops).
The REST results are OK if exe is compiled in Debug win64; data is different if compiled in release win64 ?!?
I used NO multiple threads, simple main executable with lots of services and REST endpoints.
Well.. the server is a standard exe but I'm using https://nssm.cc/ to wrap it and survive reboots and such. I'm almost sure that release win64 was always run "inside" nssm.
It's my will to transform the app into a "real" service (there is an excellent example on how to do this in a Holger's book) but had not the time yet to actually do that.
Do you mean services and exes have different behaviours ?
Well, first of all I think you should do all tests without it. I don't know what it does, but it's one extra thing that might be affecting, the less variables we need to control, the better. Please check the behavior without such tool affecting the application.
Do you mean services and exes have different behaviours ?
Not the exe itself, but they do differ slightly.
Services usually run under a different user than desktop exes. So things like user permissions and authentication might be different. You might get access denied in several operations, depending on the permissions of the service user. Probably even db authentication that relies on the logger user is also affected.
Services also have a different current directory, so depending on how your application is coded it might be reading files from different locations than the desktop exe.
I totally agree that tests must be done in exactly the same environment in order to avoid any additional "affection".
I made some additional tests and I think you made my day with your remarks about the differences between services and applications!
The difference is not between DBG and REL executable: if I run the same REL application with a double click launching a VCL app, the results are OK; if I launch it wrapped as a service some (only some!) data are different.
For example, this is correct data:
The XData server access a local MySQL db via TFDConnection using usr/psw so authentication should not be varying... but nevertheless something is different.
What is really confusing is that only some data is different (sometimes missing; other times much bigger that the correct one).
I find it curious that times are displayed different in row FLD_WRKTIM_TXT.
You really need to dig your application and see what might affect this and other settings.
The current dir might be an indication. Are you maybe loading settings from somewhere, FD configuration, DLL files...?
Mmh... interesting - the DateTime format was an issue in the past, but I solved it storing all values on DB using UTC.
It seems that the nssm wrapping forces some general settings on data flows... as you suggest a deep digging is needed.