I always thought that NAS is not multithread, but now I have real situation, which is strange and can only be possible with two processes running in one time (or at least not waiting until all code of previous process is finished).
I have two timers on one NAS instance. One timer is posting Sales Invoices. Another timer is executing Job Scheduler jobs. When on job scheduler “Post Inventory Cost to GL” job is running and Sales Invoices are posting in same time, inventory cost posting stops with error that GL entry 7489385 already exist and (what is very strange) two posted GL entries I can find in database – they where commited, but I can‘t find commit in this procedure.
In GL register I can find following entries:
No. Creation Date User ID Source Code From Entry No. To Entry No.
987166 11/09/2007 NAS_USER SALES 7489362 7489368
987167 11/09/2007 NAS_USER SALES 7489369 7489375
987168 11/09/2007 NAS_USER SALES 7489376 7489382
987169 11/09/2007 NAS_USER INVTPCOST 7489383 7489384
987170 11/09/2007 NAS_USER SALES 7489385 7489391
987171 11/09/2007 NAS_USER SALES 7489392 7489396
987172 11/09/2007 NAS_USER SALES 7489397 7489403
987173 11/09/2007 NAS_USER SALES 7489404 7489412
987174 11/09/2007 NAS_USER SALES 7489413 7489419
It seems, that Inventory Cost Posting procedure locked GL Entry, posted two entries and in some moment another process started, locked GL Entry (it was allowed, because process ID in SQL is the same), posted sales invoice, commited all entries (also posted by another process, because commit runs on SQL for all entries created by SQL process ID), then Cost Posting procedure tried to insert next entry and got error. Is it possible that it happened in such way?