Bug #2928

nanohttpd crashes often when accessing icons

Added by hans almost 4 years ago. Updated almost 4 years ago.

Status:ClosedStart date:01/31/2014
Priority:ImmediateDue date:
Assignee:hans% Done:

0%

Category:-
Target version:0.2 - ChatSecure/Bluetooth
Component:

Description

Doing a repo refresh causes lots of crashes, it seems mostly while fetching the icons:

ImageLoader  E  http://10.4.0.132:8888/fdroid/repo/icons/info.guardianproject.soundrecorder_1.png
ImageLoader  E  java.io.FileNotFoundException: http://10.4.0.132:8888/fdroid/repo/icons/info.guardianproject.soundrecorder_1.png
ImageLoader  E  at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:186)
ImageLoader  E  at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromNetwork(BaseImageDownloader.java:121)
ImageLoader  E  at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:85)
ImageLoader  E  at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.downloadImage(LoadAndDisplayImageTask.java:315)
ImageLoader  E  at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryCacheImageOnDisc(LoadAndDisplayImageTask.java:294)
ImageLoader  E  at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:238)
ImageLoader  E  at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:141)
ImageLoader  E  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
ImageLoader  E  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
ImageLoader  E  at java.lang.Thread.run(Thread.java:841)
System.out  I  GET '/fdroid/repo/icons/info.guardianproject.soundrecorder_1.png'
System.out  I  HDR: 'connection' = 'Keep-Alive'
System.out  I  HDR: 'user-agent' = 'Dalvik/1.6.0 (Linux; U; Android 4.4.2; Nexus 7 Build/KOT49H)'
System.out  I  HDR: 'remote-addr' = '10.4.0.132'
System.out  I  HDR: 'accept-encoding' = 'gzip'
System.out  I  HDR: 'host' = '10.4.0.132:8888'
System.out  I  HDR: 'http-client-ip' = '10.4.0.132'
ImageLoader  E  Image can't be decoded [https://f-droid.org/repo/icons-320/info.guardianproject.otr.app.im_95.png_128x128]
System.err  W  java.net.SocketException: Socket closed
System.err  W  at libcore.io.Posix.recvfromBytes(Native Method)
System.err  W  at libcore.io.Posix.recvfrom(Posix.java:141)
System.err  W  at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)
System.err  W  at libcore.io.IoBridge.recvfrom(IoBridge.java:506)
System.err  W  at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
System.err  W  at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
System.err  W  at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
System.err  W  at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:908)
System.err  W  at fi.iki.elonen.NanoHTTPD$1$1.run(NanoHTTPD.java:245)
System.err  W  at java.lang.Thread.run(Thread.java:841)
System.out  I  GET '/fdroid/repo/icons/info.guardianproject.soundrecorder_1.png'
System.out  I  HDR: 'cache-control' = 'max-age=0'
System.out  I  HDR: 'connection' = 'keep-alive'
System.out  I  HDR: 'remote-addr' = '10.4.0.213'
System.out  I  HDR: 'accept-language' = 'en-US,en;q=0.8,de;q=0.6,fr;q=0.4'
System.out  I  HDR: 'host' = '10.4.0.132:8888'
System.out  I  HDR: 'accept' = 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
System.out  I  HDR: 'http-client-ip' = '10.4.0.213'
System.out  I  HDR: 'user-agent' = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/32.0.1700.102 Chrome/32.0.1700.102 Safari/537.36'
System.out  I  HDR: 'accept-encoding' = 'gzip,deflate,sdch'
System.out  I  HDR: 'dnt' = '1'
System.out  I  HDR: 'if-none-match' = '4dff48ea'
System.err  W  java.net.SocketException: Socket closed
System.err  W  at libcore.io.Posix.recvfromBytes(Native Method)
System.err  W  at libcore.io.Posix.recvfrom(Posix.java:141)
System.err  W  at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)
System.err  W  at libcore.io.IoBridge.recvfrom(IoBridge.java:506)
System.err  W  at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
System.err  W  at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
System.err  W  at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
System.err  W  at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:908)
System.err  W  at fi.iki.elonen.NanoHTTPD$1$1.run(NanoHTTPD.java:245)
System.err  W  at java.lang.Thread.run(Thread.java:841)
System.err  W  java.net.SocketException: Socket closed
System.err  W  at libcore.io.Posix.recvfromBytes(Native Method)
System.err  W  at libcore.io.Posix.recvfrom(Posix.java:141)
System.err  W  at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)
System.err  W  at libcore.io.IoBridge.recvfrom(IoBridge.java:506)
System.err  W  at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
System.err  W  at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
System.err  W  at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
System.err  W  at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:908)
System.err  W  at fi.iki.elonen.NanoHTTPD$1$1.run(NanoHTTPD.java:245)
System.err  W  at java.lang.Thread.run(Thread.java:841)

History

#1 Updated by pd0x almost 4 years ago

  • Status changed from New to In Progress
  • Assignee set to pd0x

I'm not sure I'm able to reproduce this bug.

I've created a repo with all of the apps on my phone ~50 apps/icons. When I add the repo to FDroid and do a full refresh the UI displays no failures and I see all icons load near-immediately. Looking at the logcat dump on both devices I am seeing exceptions being thrown by NanoHTTPD. Specifically from this if block https://github.com/guardianproject/nanohttpd/blob/master/core/src/main/java/fi/iki/elonen/NanoHTTPD.java#L250 in NanoHTTPD.

It looks like FDroid closes the connection on it's side and NanoHTTPD isn't properly catching this condition and throws the exception up the callstack to break the serve loop.

I'll investigate further, but it seems like there is no crash, just extraneous/confusing debug information?

Hans: can you add more information if you have it?

#2 Updated by pd0x almost 4 years ago

  • Status changed from In Progress to Feedback

#3 Updated by pd0x almost 4 years ago

  • Assignee changed from pd0x to hans

Ready for review.

#4 Updated by hans almost 4 years ago

  • Status changed from Feedback to Closed

works for me, integrated into the guardianproject/nanohttpd repo. Seems like this would be good to submit upstream sooner rather than later since it probably affects others, and having it the official repo will make it easier to keep our fork in sync.

Also available in: Atom PDF