Hi magicians
It's been 4 weeks that I 'm struggling with a weird behavior of
XPA-runtime engine, noticed in all version versions from 3.3c and
above, up 4.5a:
In a desktop app, there is a program executed by a timer event, once
every second. This base-program is calling 20 resident sub-tasks
(reading some data from database and making some calculations).
Some of the sub-tasks tasks read SQL2014 tables (on SSD drive),
while the rest do only arithmetic calculations without accessing the
database.
During runtime, the whole process starts by taking around 350
milliseconds to execute, and this is quite acceptable for an event
called every 1 second.
While executing the program keeps on slowing down: after 2 hours it
will exceed the 1000 millisecond limit and will create an
event-bottleneck.
Note that, this delay will not change if I stop and restart the
event, or if I exit the program. The only way to reset back to
normal execution times is to exit system and restart Magic.
While trying to locate the cause, I added time-logging code in all
critical points. And this is where the strangest part comes:
- Database accessing subtasks that were taking some time to
execute (e.g. 15-ms), they still report the same execution time
- Calculation subtasks with no access to database (exiting after
a single record-suffix execution), report increasing execution
times: they start from 0 ms and they gradually jump to 15-16 ms.
- Note that these 15-16 ms seems to be the maximum accuracy I
can get using the mTime() function for logging.
Some more remarks:
- All subtasks are "non-abortable" (no events allowed)
- I tried both options: resident or not resident tasks, and saw
no difference
- The behavior does not change whether executing from within the
XPA-Studio (debug on or off), or directly with XPA-Runtime.
- Tried many type of database locking schemes and saw no
difference. Anyway the delay seems to happen more with
non-database accessing subtasks
- Tried replacing some of the SQL tables with memory tables, and
saw no difference.
- When tasks have already slowed down, the windows task-manager
does not show any increase in CPU usage (always below 10%) or
Memory usage (at least 40% of total memory free)
If anyone has similar experience or ideas, please let me know.
Thanks in advance
Avgerinos