Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Game programming

too many recursive events

All about the StoneScript

too many recursive events

Postby gn0me » 18 Apr 2012, 02:02

Hi there
i've encountered some error msg:

Too many recursive events flushing calls (max 8 ), ignored.


What exactly can it cause?
After this error, unfortunately, it is required to restart shiva.
| Shiva 1.9.2b2 / Celeron G530 / HD 6770 | Android 4.04 |
User avatar
gn0me
Expert Boarder
Expert Boarder
 
Posts: 86
Location: pl

Re: too many recursive events

Postby Fraser » 18 Apr 2012, 03:39

Maybe the code that one of your event handlers is calling is itself sending an event to the same event handler.
Fraser Ashworth,
https://www.cortex7.net
User avatar
Fraser
Platinum Boarder
Platinum Boarder
 
Posts: 1040
Location: Europe

Re: too many recursive events

Postby Badger » 13 Jul 2012, 12:31

I had this exact error just now, so started searching. Quit Shiva (all code was saved already), restarted, no more error.
________________________________
˙ןǝnuɐɯɯǝ osןɐ ɯ,ı
User avatar
Badger
Expert Boarder
Expert Boarder
 
Posts: 152
Location: Australia

Re: too many recursive events

Postby 8DashP » 28 Nov 2012, 04:33

Just for documentation purposes, I just had this as well. Quit and restart fixed it, but I wonder what causes it? This was after the first time I tried a while loop in a custom event, that got stuck in an endless loop a few times. But even after I removed it, the error still happened, so I assume something is not being flushed properly when the game is restarted.
Russell - http://store.synapticbytes.com - Software Store now open, including ShiVa3D assets
Checkout sbPhysics, the bullet physics plugin, plus the Partifex particle libraries on the store
User avatar
8DashP
Platinum Boarder
Platinum Boarder
 
Posts: 1119
Location: Queensland, Australia

Re: too many recursive events

Postby NiCoX » 28 Nov 2012, 13:22

Hi,

Too many recursive events flushing calls (max 8 ), ignored.


This is due to the use of object.sendEventImmediate or user.sendEventImmediate. Use those functions only when you *need* an event to be executed immediately, else it is recommended to use object.sendEvent or user.sendEvent, and let the engine flush the events queue.
User avatar
NiCoX
Platinum Boarder
Platinum Boarder
 
Posts: 5639
Location: France

Re: too many recursive events

Postby 8DashP » 28 Nov 2012, 19:58

NiCoX wrote:Hi,

Too many recursive events flushing calls (max 8 ), ignored.


This is due to the use of object.sendEventImmediate or user.sendEventImmediate. Use those functions only when you *need* an event to be executed immediately, else it is recommended to use object.sendEvent or user.sendEvent, and let the engine flush the events queue.


Well the only problem there is, I don't send any events anywhere.
Russell - http://store.synapticbytes.com - Software Store now open, including ShiVa3D assets
Checkout sbPhysics, the bullet physics plugin, plus the Partifex particle libraries on the store
User avatar
8DashP
Platinum Boarder
Platinum Boarder
 
Posts: 1119
Location: Queensland, Australia

Re: too many recursive events

Postby michax » 29 Nov 2012, 03:13

Same here, after shiva restart problem was "fixed". Never occured on exported app in my case.
User avatar
michax
Platinum Boarder
Platinum Boarder
 
Posts: 465
Location: Poland

Re: too many recursive events

Postby 8DashP » 18 Dec 2012, 06:08

So can we get some clarification on exactly when not to use SendEventImmediate?

I'm about to start implementing collision callbacks in my physics plugin. Given the "urgent" nature of responding to a collision, to ensure you process it before the object has moved on in the world, I'd think I need to callback into Shiva with a SendEventImmediate. But, there could be quite a lot of these callbacks being triggered at once, and if there is an issue with the number of active calls of this type, I need to know. If I can't use it, I'm not sure how responsive collision callbacks will be, if I can only use SendEvent to return collision information.
Russell - http://store.synapticbytes.com - Software Store now open, including ShiVa3D assets
Checkout sbPhysics, the bullet physics plugin, plus the Partifex particle libraries on the store
User avatar
8DashP
Platinum Boarder
Platinum Boarder
 
Posts: 1119
Location: Queensland, Australia

Re: too many recursive events

Postby dreamora » 18 Dec 2012, 11:37

the error is about recursive, not concurrent events so it should not impact you :)

Recursive means that a function triggered by an event triggers the same event again hence making it enter an infinite loop (fibonacci through events for example would go down this path without a break condition)
I'm no stonetrip representative, just a happy board member like you :)

If you find my portfolio interesting, feel free to contact me or follow my shares on my twitter stream or my game development blog
User avatar
dreamora
Platinum Boarder
Platinum Boarder
 
Posts: 844

Re: too many recursive events

Postby 8DashP » 18 Dec 2012, 13:08

Yeah I know what recursion is, but given the times it has happened to me haven't involved recursion on my end that I know of, and NiCox's warning about using it, I didn't know if the error message was that meaningful. I'm still to test whether immediacy will be an issue for me or not, but it'd be good to know up front if the call has any gotchas.
Russell - http://store.synapticbytes.com - Software Store now open, including ShiVa3D assets
Checkout sbPhysics, the bullet physics plugin, plus the Partifex particle libraries on the store
User avatar
8DashP
Platinum Boarder
Platinum Boarder
 
Posts: 1119
Location: Queensland, Australia

Re: too many recursive events

Postby dreamora » 18 Dec 2012, 13:15

There is indeed a limit on parallel events too.
But I don't recall NicoX and anyone else from the team ever giving out the exact number limit for the event queue nor do I expect it to never have changed actually.

That being said: physics don't need to provide it immediately unless I miss something.
The physics step where the collision etc happened has already been simulated and input and changes will not take place until the next simulation which is 10-50ms far away. As such it would make sense to have the event before the next frame rendering takes place which is the case for normally sent events.

is there something specific you want to achieve where using immediate makes any practical sense?
I'm no stonetrip representative, just a happy board member like you :)

If you find my portfolio interesting, feel free to contact me or follow my shares on my twitter stream or my game development blog
User avatar
dreamora
Platinum Boarder
Platinum Boarder
 
Posts: 844

Re: too many recursive events

Postby 8DashP » 18 Dec 2012, 13:23

I'm mainly reacting to the notes in the Bullet documentation where it says collisions may come and go multiple times during a single simulation step, especially for fast moving objects.

So I don't want to send a callback saying a collision has occurred whichb s only recieved by Shiva after the physics simulation has moved on a couple steps. I guess I'm not familiar with the actual time variances between events, frames, and physics simulation steps, so I'm assuming the worst and trying to cater for it.
Russell - http://store.synapticbytes.com - Software Store now open, including ShiVa3D assets
Checkout sbPhysics, the bullet physics plugin, plus the Partifex particle libraries on the store
User avatar
8DashP
Platinum Boarder
Platinum Boarder
 
Posts: 1119
Location: Queensland, Australia

Re: too many recursive events

Postby NiCoX » 18 Dec 2012, 23:37

Hi,

Too many recursive events flushing calls (max 8 ), ignored.


FYI in the latest UAT we raised this number to 32. But as dreamora wrote, an immediate reaction may only be useful in rare usage cases...
User avatar
NiCoX
Platinum Boarder
Platinum Boarder
 
Posts: 5639
Location: France


Return to Game programming