Inside a Task node, When API call's Roku Device Restart's Automatically.

I tried to API call using below logic inside a Task node.

I test using the Postman tool My File Response takes around 800ms. I applied different below logic and the Results inside a Task node For fetch response from API.

'First Logic

url = "http://MyAPIHost:port/API.json"
rxfer.SetUrl(url)
m.raw = rxfer.GetToString()
json = ParseJSON(m.raw)

'When I performed the First logic. Results are below :

When the Application launch :

  1. First Time Device Restarted
  2. Second Time It’s Give Execution Timeout error
  3. Third Time It’s working

'Second Logic

url = "http://MyAPIHost:port/API.json"
rxfer.SetUrl(url)
m.port = CreateObject("roMessagePort")
rxfer.SetPort(m.port)
rxfer.AsyncGetToString()
m.msg = wait(3000,m.port)
if m.msg = invalid then 
   rxfer.AsyncCancel()
else
   m.raw = m.msg.GetString()
   ?"m.raw : "m.raw
end if 
json = ParseJSON(m.raw)

'When I performed the Second logic. Results are below :

When the Application launch :

  1. First Time Device Restarted
  2. Second Time Device Restarted
  3. Third Time It’s Give Execution Timeout error
  4. Fourth Time It’s Give Execution Timeout error
  5. Fifth Time It’s working

Third Logic(Using Internal File):

m.raw = ReadASCIIFile("pkg:/api/API.json")
json = ParseJSON(m.raw)

'When I performed the Third logic. Results are below :

When the Application launch :

  1. First Time It’s Working

I don’t understand one thing. It’s giving a Execution timeout error. It’s ok but why Roku Device restart’s the Automatic. Does any one knows about this issue?

You are not creating a roUrlTransfer object.

url = "http://MyAPIHostSort/API.json"
rxfer = CreateObject("roUrlTransfer")  
rxfer.SetUrl(url) 
m.raw = rxfer.GetToString()
json = ParseJSON(m.raw)
print json

I have already created the roUrlTransfer object. I wrote code in short for better visibility.