Backendless Support
 
Answered

Business Logic-Cannot allocate new thread

Greetings,

Am trying to make an external Api Call from within my Cloud Code to validate a sign in user token but getting the error

  1. {"code":0,"message":"Cannot allocate new thread. You can remove this limitation by purchasing a function pack in Backendless Marketplace.","errorData":{}}

It's the only thing being done in the handleEvent code block of the event handler other than the HashMap result being sent back to the client side.

Is this possible, to call an external Api from a Custom Event Handler in Cloud Code? Am on the Developer price option.

Regards,

George

Leave a Comment

Comments (8)

photo
1

I'm getting a similar message when I attempt to access a third party API:

  1. [ERROR] You have no permission to create thread in CodeRunner secure group.

Basically a deal breaker for me, is there any way to access third party API without throwing a thread error?

photo
1

yes, you can use URLConnection to call external API

photo
1

I am using URLConnection however I'm still getting the above error. What is the difference between my error and the error that George posted?

photo
1

URLConnection only? What about other networking libraries e.g Retrofit which is what i have implemented and getting the error, could this be the cause?

photo
1

Mitchell's answer below can actually explain the cause for lots of libraries, too, in case they use URLConnection (which is very likely). Otherwise this is still out of Backendless scope, since you'll have to figure out how and why the library is creating additional threads - either by yourself or by asking the library authors.

photo
photo
1

or you can buy extra threads in the backendless marketplace

photo
1

George,

For your reference I fixed my issue as per here: http://support.backendless.com/topic/business-logic-thread-creation

photo
1

Thank you Mitchell, I’ll try it out and revert.

George.

photo