7 Replies Latest reply on Dec 11, 2012 5:24 AM by Gerbrand Stap

    Crash on Android using AsyncHttp in separate thread

    Gerbrand Stap

      The following code runs just fine (assuming www.viadata.nl can be reached):


      require 'rho'
      require 'rho/rhocontroller'
      class TestController < Rho::RhoController
        def index
          RhoLog.info( 'CTD', 'Excecuting process in main thread' )
          RhoLog.info( 'CTD', 'Excecuting process in separate thread' )
          Thread.new{ self.process }
        def process
          RhoLog.info( 'CTD', 'Process start' )
          result = Rho::AsyncHttp.get(
            :url => 'http://www.viadata.nl/'
            #:url => 'http://www.thisurldoesnotexist.org/'
          RhoLog.info( 'CTD', 'Performed AsyncHttp call' )


      But there are two ways to make this crash on Android:

      • Make sure no connection is available, or replace the url by a non-existing one.
      • Remove the statement that executes the process on the main thread (self.process)


      The crash does not occur in the Windows simulator, or on iOS.

      The project with the given TestController and the message that appears after the crash are attached.