Problem with accessing internet from Ruboto

17 views
Skip to first unread message

toomus

unread,
Nov 30, 2017, 4:08:44 AM11/30/17
to Ruboto (JRuby on Android)
Hi,
I have problem with connecting to internet from Ruboto with this code:
Thread.start do
  url = URI.parse('https://my.domain.com')
  http = Net::HTTP.new(url.host, url.port)
  http.use_ssl = true
  data = 'some_param=test'
  headers = {
      'Cache-Control' => 'no-cache',
      'Content-Type' => 'application/x-www-form-urlencoded'
  }
  resp = http.post('/api/v2/token', data, headers)
  JSON.parse(resp.body)['access_token']
end

Application is running and in adb logcat there is no error, only a lot of Garbage Collector logs:
I/art     ( 2249): Background partial concurrent mark sweep GC freed 239954(6MB) AllocSpace objects, 0(0B) LOS objects, 10% free, 32MB/36MB, paused 1.086ms total 108.010ms
I
/art     ( 2249): Background partial concurrent mark sweep GC freed 227651(6MB) AllocSpace objects, 0(0B) LOS objects, 10% free, 32MB/36MB, paused 769us total 108.259ms
I
/art     ( 2249): Background partial concurrent mark sweep GC freed 178526(4MB) AllocSpace objects, 0(0B) LOS objects, 10% free, 33MB/37MB, paused 352us total 112.651ms
I
/art     ( 2249): Background partial concurrent mark sweep GC freed 252640(7MB) AllocSpace objects, 0(0B) LOS objects, 10% free, 33MB/37MB, paused 828us total 115.196ms
I
/art     ( 2249): Background partial concurrent mark sweep GC freed 229172(6MB) AllocSpace objects, 0(0B) LOS objects, 10% free, 32MB/36MB, paused 433us total 107.415ms
I
/art     ( 2249): Background partial concurrent mark sweep GC freed 234862(6MB) AllocSpace objects, 0(0B) LOS objects, 10% free, 33MB/37MB, paused 916us total 106.421ms
I
/art     ( 2249): Background partial concurrent mark sweep GC freed 267608(7MB) AllocSpace objects, 0(0B) LOS objects, 10% free, 33MB/37MB, paused 1.327ms total 117.025ms
I
/art     ( 2249): Background partial concurrent mark sweep GC freed 201993(5MB) AllocSpace objects, 0(0B) LOS objects, 10% free, 32MB/36MB, paused 991us total 116.435ms




Uwe Kubosch

unread,
Nov 30, 2017, 4:11:57 AM11/30/17
to rub...@googlegroups.com
Hi!

It may be that your exception is swallowed by the Thread. Try encapsulating the whole Thread block within begin … rescue <log the exception> end.


--
Uwe Kubosch
u...@kubosch.no
> --
> You received this message because you are subscribed to the Google Groups "Ruboto (JRuby on Android)" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ruboto+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

toomus

unread,
Nov 30, 2017, 4:30:03 AM11/30/17
to Ruboto (JRuby on Android)
Hi donV,
Thanks for suggestion. I add rescue and nothing was raised, but I also add some logs to code and looks like it hangs in this line:
resp = http.post('/api/v2/token', data, headers)

And in adb logcat is message:
I/System.out( 2547): Starting JOpenSSL Service
I
/art     ( 2547): WaitForGcToComplete blocked for 9.569ms for cause HeapTrim
I
/art     ( 2547): WaitForGcToComplete blocked for 33.242ms for cause HeapTrim
I
/art     ( 2547): WaitForGcToComplete blocked for 6.887ms for cause HeapTrim
I
/art     ( 2547): WaitForGcToComplete blocked for 14.067ms for cause HeapTrim
I
/art     ( 2547): WaitForGcToComplete blocked for 27.430ms for cause HeapTrim





Uwe Kubosch

unread,
Nov 30, 2017, 4:40:28 AM11/30/17
to rub...@googlegroups.com
OpenSSL and https has been a problem. Can you try it with “http” and see if it works then? If so, we know it is an SSL problem.


--
Uwe Kubosch
u...@kubosch.no

toomus

unread,
Nov 30, 2017, 5:03:27 AM11/30/17
to Ruboto (JRuby on Android)
Yes, it looks like issue with SSL - http works. Is there any possible solution for this?

Uwe Kubosch

unread,
Nov 30, 2017, 8:50:50 AM11/30/17
to rub...@googlegroups.com
Yes, but it will probably involve getting JRuby 9K to work.

--
Uwe Kubosch
u...@kubosch.no



> On 30 Nov 2017, at 11:03, toomus <tomasz...@gmail.com> wrote:
>
> Yes, it looks like issue with SSL - http works. Is there any possible solution for this?
>
Reply all
Reply to author
Forward
0 new messages