Recent

Author Topic: Runtime(0) Error  (Read 5076 times)

JimKueneman

  • Full Member
  • ***
  • Posts: 220
Re: Runtime(0) Error
« Reply #30 on: July 02, 2020, 09:13:57 pm »
Is the "DoReceiveMessage" being called via  Sync code ? if not it should be..

Yes through here, this is the thread code.

Code: Pascal  [Select][+][-]
  1.  RcvByte := Socket.RecvByte(1);
  2.               case Socket.LastError of
  3.                 0 :
  4.                   begin
  5.                     GridConnectStrPtr := nil;
  6.                     if GridConnectHelper.GridConnect_DecodeMachine(RcvByte, GridConnectStrPtr) then
  7.                     begin
  8.                       FEthernetRec.MessageStr := GridConnectBufferToString(GridConnectStrPtr^);
  9.                       FEthernetRec.LccMessage.LoadByGridConnectStr(FEthernetRec.MessageStr);
  10.                       Synchronize({$IFDEF FPC}@{$ENDIF}DoReceiveMessage);
  11.                     end;
  12.                   end;
  13.                 WSAETIMEDOUT :
  14.  

JimKueneman

  • Full Member
  • ***
  • Posts: 220
Re: Runtime(0) Error
« Reply #31 on: July 02, 2020, 09:15:54 pm »
Ok I am going to blame it on 2020, what else could it be.... I added a thread safe queue between the thread and the main process and used a timer to pull out the strings from the thread safe string list and it does the EXACT SAME THING......


jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Runtime(0) Error
« Reply #32 on: July 02, 2020, 09:19:13 pm »
what kind of strings are you using ? if you are using managed strings please try something that isn't managed.

array of char, ShortString etc..
The only true wisdom is knowing you know nothing

JimKueneman

  • Full Member
  • ***
  • Posts: 220
Re: Runtime(0) Error
« Reply #33 on: July 02, 2020, 10:04:12 pm »
Well that is unfulfilling..... I lost the network connection between my VM and OS X and the only way I could get it working again was to reboot the Mac....  Now it works regardless of how I handle the thread....  The first time the Mac has been rebooted in months.
« Last Edit: July 02, 2020, 10:13:33 pm by JimKueneman »

JimKueneman

  • Full Member
  • ***
  • Posts: 220
Re: Runtime(0) Error
« Reply #34 on: July 02, 2020, 10:58:43 pm »
I just hammered the heck out of it creating thousands of nodes and not a single issue....  Thanks for the help.

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: Runtime(0) Error
« Reply #35 on: July 02, 2020, 11:08:30 pm »
It's like magic  :D

JimKueneman

  • Full Member
  • ***
  • Posts: 220
Re: Runtime(0) Error
« Reply #36 on: July 02, 2020, 11:12:57 pm »
It's like magic  :D

And I hate it..... it will be back..... I know it....   things don't "fix themselves".....

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Runtime(0) Error
« Reply #37 on: July 02, 2020, 11:19:13 pm »
Hi!

Must not be magic.

Could be something only the NASA takes care of:

Statistically in every PC there are 2 to 3 bits flipped in 24 hours due to hard radiation from the sun.
If you are lucky it is in the empty part of the RAM.
Or just a pixel in an icon.
Or just a letter in an error message.

But if you got bad luck it can hit a node.
And then you got that miracle!

winni

TRon

  • Hero Member
  • *****
  • Posts: 2432
Re: Runtime(0) Error
« Reply #38 on: July 02, 2020, 11:22:34 pm »
It's like magic  :D

And I hate it..... it will be back..... I know it....   things don't "fix themselves".....
hmz... turn computer off, problem goes away... I should use that more often  :D

But jokes aside, your project wouldn't be the only one in existence that requires a reboot once in a while. I remember a piece of hardware back in the dos and early windows days, that would just confuse itself over a period of time (bad hw design) and required a proper reboot of the machines once a week. Let the machine run for 1 week and 1 day, and you were back in software-hell. And of course the hardware manufacturer blamed it on the software.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Runtime(0) Error
« Reply #39 on: July 02, 2020, 11:28:13 pm »
Hi!

We got a " Master PC" runing 24/7 to get the updates for the other clients for a finance software.
That PC is Win7/64. There is a big chance that after 30 days the network connection is lost - no chance to recover without reboot. So we boot that machine every 14 days.

Winni

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: Runtime(0) Error
« Reply #40 on: July 02, 2020, 11:40:02 pm »
2^32 seconds is 49.7 days  :D

(The well known counter overflow  ;))

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Runtime(0) Error
« Reply #41 on: July 02, 2020, 11:44:32 pm »
Yes - that were the NT-days.
That is fixed now.

But what about the other 27543 unknown window bugs?

Winni




rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: Runtime(0) Error
« Reply #42 on: July 03, 2020, 12:34:09 am »
Yes - that were the NT-days.
That is fixed now.
In Windows itself yes. I would bet there are still tons of programs (and libraries) which still use GetTickCount over GetTickCount64.

(And GetTickCount64 isn't even available on XP  :P )

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Runtime(0) Error
« Reply #43 on: July 03, 2020, 12:54:46 am »
Bad enough - but you are so right.

But GetTickCount64 is enough  for the near future.

For the next 500 000 000 years .....

Winni

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Runtime(0) Error
« Reply #44 on: July 03, 2020, 01:13:21 pm »
2^32 seconds is 49.7 days  :D

(The well known counter overflow  ;))

Never had an issue with that. I made a function where by it would detect the overflow and increment another variable in the app.

 The app never used the return results directly from the 32 bit version of that function but the enhanced version I had in the app..

 Just let it wrap around, if its smaller than last time, increment the upper 32 bit value.

that is who you do most wrap arounds in code..  :)
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018