Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ERR_REF_COUNT_LIMIT for Timeout

Im getting a Fatal Jerryscript Error: ERR_REF_COUNT_LIMIT error when I try to start a timeout. Any suggestions for how to overcome this?

 

const signalTimeout;
if ((flag === true) && (!signalTimeout) ) { signalTimeout = setTimeout(noSignal(), 1800000); console.log('set signal timeout') }

There is a clearTimeout later when a signal is received, however the fatal error occurs right after entering the conditional statement.

 

Thanks,

 

Best Answer
0 Votes
7 REPLIES 7

This is just a guess, but try deleting the () in noSignal().

Peter McLennan
Gondwana Software
Best Answer
0 Votes
Thanks for the suggestion but Im still getting a ref count limit for some
reason...
Best Answer
0 Votes

A reference count limit can be caused by trying to keep too many references to an object. I'm wondering now if there's something in your function that's creating heaps of references; eg, getElementById.

 

Recursion could be another culprit.

 

I still feel that those () are a worry.

Peter McLennan
Gondwana Software
Best Answer

You're calling noSignal (look at those parenthesis()) instead of juat passing it to setTimeout.

If you have that piece of code inside some kind of loop, it could reach some limits bevause it gets executed without limits.

Add a console log to see how many times it gets called just in case. 

Best Answer
0 Votes
Hmm thanks. I removed the parenthesis but I am still getting this error.
Best Answer
0 Votes

> Hmm thanks. I removed the parenthesis but I am still getting this error.

Then this code must be called too often resulting in creation of more than 1024 timers. I don't see any other possibilities. In this case, you must see more than thousand log messages.

But the typical reason for this error is not associated with this code but rather with usage of getElementById on every UI update without caching. To check that, try to comment out that code and see if you still get an error.

Best Answer
0 Votes

I suspect the problem lies elsewhere in your code. That snippet works fine for me, when spurious () removed.

Peter McLennan
Gondwana Software
Best Answer
0 Votes