Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 

Task getting aborted by Roku system

Hi there,

So I am trying to post some analytics to a server inside a Task node during video/ad playback, but the Task never functions. The Roku system is aborting the thread. Error message below:

=================================================================
Warnings occurred while spawning thread for Task component AnalyticsTask
spawning thread aborted because: channel exit or timeout waiting for render thread
=================================================================

So essentially the Task can't run because the render thread is currently doing too much work? My understanding is that as of firmware 7.5, all threads will wait indefinitely to complete. Quote from SDK docs below:
     
As of firmware version 7.5, thread rendezvous no longer timeout and will wait indefinitely. The rendezvous information below is only valid for firmware version 7.2 and older.
Task node thread rendezvous can time out after a few seconds. This can happen if the render thread is very busy, maybe with other rendezvous operations. If a timeout occurs while getting a field, the response will be invalid, which may crash the application if the script is not prepared for the invalid response. During application development, you should check for these timeouts to increase the performance of your published application.
Also note that the render thread can time out while it is executing long linear searches, long iterative calculations, synchronous file accesses, and the like. These types of operations not only slow down the rendering of the UI, but can lead to a rendezvous timeout generating an invalid response, possibly crashing the application. Push computing not directly related to rendering or reacting to the UI into Task node threads.


If anyone has tips on how I can resolve this, I would greatly appreciate it.
0 Kudos
5 Replies
EnTerr
Level 8

Re: Task getting aborted by Roku system

The change in thread locks does not mean however that the completion of the main program will sit and wait on your analytics thread. If you want to wait on the thread to finish first - wait on that in main
0 Kudos
Veeta
Level 7

Re: Task getting aborted by Roku system

I've had various issues with tasks.  It may be that right after setting the control field for the task you go off and do some large processing and may tie up the render thread while the newly created task thread is trying to clone some data.  This is just speculation.

I recommend a different architecture.  For something you'll regularly invoke, like analytics, you can spawn one thread at application start and leave it running for the duration of the app.  Then you use the MessagePort version of observeField to have it listen for analytics events to send.

There's an example of this at https://github.com/veeta-tv/roku-gamp/tree/master/roku-gamp/components
0 Kudos
EnTerr
Level 8

Re: Task getting aborted by Roku system

"Veeta" wrote:
I've had various issues with tasks.  It may be that right after setting the control field for the task you go off and do some large processing and may tie up the render thread while the newly created task thread is trying to clone some data.  This is just speculation.

so the rendezvous do do expire?!
contrary to what the quote on 7.5 above says?
0 Kudos
Veeta
Level 7

Re: Task getting aborted by Roku system

"EnTerr" wrote:
"Veeta" wrote:
I've had various issues with tasks.  It may be that right after setting the control field for the task you go off and do some large processing and may tie up the render thread while the newly created task thread is trying to clone some data.  This is just speculation.

so the rendezvous do do expire?!
contrary to what the quote on 7.5 above says?

Looking closer, it appears the situation described by the warning is actually separate from a rendezvous and the documentation isn't applicable.  Rendezvous applies to setting/getting of fields in a spawned thread, whereas the warning is describing an issue with the thread creation.
Seeing some code would be really helpful.  There could be other situations like the Task node being destroyed before the thread gets created.
0 Kudos

Re: Task getting aborted by Roku system

"Veeta" wrote:
I've had various issues with tasks.  It may be that right after setting the control field for the task you go off and do some large processing and may tie up the render thread while the newly created task thread is trying to clone some data.  This is just speculation.

I recommend a different architecture.  For something you'll regularly invoke, like analytics, you can spawn one thread at application start and leave it running for the duration of the app.  Then you use the MessagePort version of observeField to have it listen for analytics events to send.

There's an example of this at https://github.com/veeta-tv/roku-gamp/tree/master/roku-gamp/components

Thanks Veeta, this structure seems to work much better for us. I really appreciate the advice! 
0 Kudos