Opened 13 months ago

Closed 6 months ago

#2125 closed defect (fixed)

Snark fail on reopend after deleting file (was: stack overflow)

Reported by: Reportage Owned by: zzz
Priority: minor Milestone: 0.9.36
Component: apps/i2psnark Version: 0.9.29
Keywords: Cc:
Parent Tickets:

Description (last modified by zzz)

If a user deletes the downloaded content (from file manager etc) while the torrent is actively downloading, i2psnark generates an error 500 when the main page is refreshed, After a few moments, the torrent download is resumed and the error disappears upon page refresh. Ideally, i2psnark should display a more user-friendly error within the UI (to allow for automatic refresh) or none, and restart the download silently or prompt the user to determine if the torrent file should be deleted. Tested on an older version of I2P (0.9.29) but likely still present in current release.

If the download is an i2pupdate, the sidebar download indicator freezes at the point the download is first deleted, and does not update after.

java.lang.StackOverflowError
	at net.i2p.util.Log.log(Log.java:114)
	at net.i2p.util.Log.warn(Log.java:158)
	at org.klomp.snark.TrackerClient.halt(TrackerClient.java:180)
	at org.klomp.snark.Snark.stopTorrent(Snark.java:623)
	at org.klomp.snark.Snark.stopTorrent(Snark.java:612)
	at org.klomp.snark.SnarkManager.stopTorrent(SnarkManager.java:2070)
	at org.klomp.snark.UpdateRunner.fatal(UpdateRunner.java:186)
	at org.klomp.snark.UpdateRunner.updateStatus(UpdateRunner.java:247)
	at org.klomp.snark.Snark.stopTorrent(Snark.java:639)
	at org.klomp.snark.Snark.stopTorrent(Snark.java:612)
	at org.klomp.snark.SnarkManager.stopTorrent(SnarkManager.java:2070)
	at org.klomp.snark.UpdateRunner.fatal(UpdateRunner.java:186)
	at org.klomp.snark.UpdateRunner.updateStatus(UpdateRunner.java:247)
	
...

	at org.klomp.snark.Snark.stopTorrent(Snark.java:639)
	at org.klomp.snark.Snark.stopTorrent(Snark.java:612)
	at org.klomp.snark.SnarkManager.stopTorrent(SnarkManager.java:2070)
	at org.klomp.snark.UpdateRunner.fatal(UpdateRunner.java:186)
	at org.klomp.snark.UpdateRunner.updateStatus(UpdateRunner.java:247)
	at org.klomp.snark.Snark.stopTorrent(Snark.java:639)

Subtickets

Change History (9)

comment:1 Changed 13 months ago by Reportage

  • Description modified (diff)

comment:2 Changed 13 months ago by Reportage

  • Description modified (diff)

comment:3 Changed 13 months ago by zzz

  • Status changed from new to open

Heh. Good one.

The UpdateRunner? is in the stack trace, this is presumably the i2pupdate-xxx.su3 file that was being automatically downloaded and you deleted?

This issue may be unique to that code path, as there's some extra callbacks. Or maybe not.

comment:4 Changed 13 months ago by Reportage

Yes, the torrent in question was the i2pupdate.

comment:5 Changed 13 months ago by zzz

  • Milestone changed from undecided to 0.9.33
  • Resolution set to fixed
  • Status changed from open to closed

Comment 3 confirmed, this is unique to update torrent.
Untested but should be fixed in efdce04534e313d51d7f826c16c4c52976644b1a to be 0.9.32-20

comment:6 Changed 12 months ago by Reportage

  • Milestone changed from 0.9.33 to 0.9.34
  • Resolution fixed deleted
  • Status changed from closed to reopened

Similar issue found for normal torrent data. This appears to be a related issue, so I'm reopening this bug rather than file a new one.

Steps to reproduce:

  • Download a torrent
  • When torrent is finished, delete the downloaded data from file manager
  • Torrent still registers as complete, so stop torrent and force recheck - no change in torrent listing, message log reports failed check: Could not reopen storage: java.io.IOException: File does not exist
  • Attempt to start torrent, Error 500 follows

Expected result: I2PSnark should reset the torrent status when manual file check fails, if not before.

HTTP ERROR 500

Problem accessing /i2psnark/_post. Reason:

    Server Error

Caused by:

java.lang.RuntimeException: Could not reopen storage: java.io.IOException: File does not exist: XXX.zip
	at org.klomp.snark.Snark.fatal(Snark.java:1205)
	at org.klomp.snark.Snark.x_startTorrent(Snark.java:611)
	at org.klomp.snark.Snark.startTorrent(Snark.java:556)
	at org.klomp.snark.SnarkManager.startTorrent(SnarkManager.java:2772)
	at org.klomp.snark.SnarkManager.startTorrent(SnarkManager.java:2750)
	at org.klomp.snark.web.I2PSnarkServlet.processRequest(I2PSnarkServlet.java:1096)
	at org.klomp.snark.web.I2PSnarkServlet.doGetAndPost(I2PSnarkServlet.java:267)
	at org.klomp.snark.web.I2PSnarkServlet.doPost(I2PSnarkServlet.java:161)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
	at net.i2p.servlet.filters.XSSFilter.doFilter(XSSFilter.java:30)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
	at net.i2p.router.web.HostCheckHandler.handle(HostCheckHandler.java:78)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
	at org.eclipse.jetty.server.Server.handle(Server.java:499)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258)
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: File does not exist: XXX.zip
	at org.klomp.snark.Storage.reopen(Storage.java:714)
	at org.klomp.snark.Snark.x_startTorrent(Snark.java:606)
	... 33 more

Caused by:

java.io.IOException: File does not exist: XXX.zip
	at org.klomp.snark.Storage.reopen(Storage.java:714)
	at org.klomp.snark.Snark.x_startTorrent(Snark.java:606)
	at org.klomp.snark.Snark.startTorrent(Snark.java:556)
	at org.klomp.snark.SnarkManager.startTorrent(SnarkManager.java:2772)
	at org.klomp.snark.SnarkManager.startTorrent(SnarkManager.java:2750)
	at org.klomp.snark.web.I2PSnarkServlet.processRequest(I2PSnarkServlet.java:1096)
	at org.klomp.snark.web.I2PSnarkServlet.doGetAndPost(I2PSnarkServlet.java:267)
	at org.klomp.snark.web.I2PSnarkServlet.doPost(I2PSnarkServlet.java:161)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
	at net.i2p.servlet.filters.XSSFilter.doFilter(XSSFilter.java:30)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
	at net.i2p.router.web.HostCheckHandler.handle(HostCheckHandler.java:78)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
	at org.eclipse.jetty.server.Server.handle(Server.java:499)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258)
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
	at java.lang.Thread.run(Thread.java:748)

comment:7 Changed 12 months ago by zzz

Not really related to OP at all, OP was a stack overflow specific to the update torrent. But it's fine to leave it on this ticket.

The current issue is deep in the way we do "reopen" (and this ticket was reopened, how appropriate) and may not be easy to fix. For further research.

comment:8 Changed 8 months ago by zzz

  • Description modified (diff)
  • Milestone changed from 0.9.34 to 0.9.36
  • Summary changed from Deleting downloaded content in i2psnark while download is running causes (temporary) stack overflow to Snark fail on reopend after deleting file (was: stack overflow)

Edited OP and summary which was fixed in .33. Pushing out issue in comment 6, low priority

comment:9 Changed 6 months ago by zzz

  • Resolution set to fixed
  • Status changed from reopened to closed

comment 6 issue in d9009871124262347550c0328e687eebbb7448c5 0.9.35-12

Note: See TracTickets for help on using tickets.