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3_2
i2p_0_3_1_5
i2p_0_3_1_4
i2p_0_3_1_3
i2p_0_3_1_2
i2p_0_3_1_1
i2p_0_3_1
i2p_0_3_0_4
i2p_post_great_renaming
i2p_0_3_0_3
Labels
Clear labels
#1026
#1031
#1033
#1036
#1040
#1049
#1051
#1065
#1067
#1076
#1105
#1112
#1139
#1166
#1170
#1172
#1176
#1200
#1222
#1223
#1259
#1263
#1274
#1289
#1302
#1304
#1306
#1308
#1320
#1337
#1338
#1372
#1381
#1384
#1393
#1399
#1410
#1415
#1418
#1438
#1453
#1460
#1479
#1491
#1499
#1519
#1522
#1560
#1564
#1584
#1609
#1613
#1637
#1655
#1657
#1684
#1685
#1689
#1694
#1697
#1716
#1724
#1740
#1742
#1753
#1758
#1766
#1767
#1775
#1802
#1805
#1834
#1837
#1838
#1847
#1848
#1869
#1877
#1893
#1907
#1911
#1915
#1928
#1938
#1951
#1979
#1981
#1982
#1985
#1990
#1999
#2018
#2023
#2024
#2035
#2039
#2056
#2080
#2081
#2083
#2085
#2086
#2088
#2090
#2099
#2100
#2101
#2102
#2106
#2110
#2112
#2114
#2121
#2142
#2145
#2146
#2147
#2149
#2158
#2160
#2162
#2169
#2173
#2177
#2182
#2193
#2212
#2221
#2230
#2231
#2233
#2238
#2240
#2241
#2244
#2251
#2252
#2255
#2257
#2259
#2261
#2263
#2264
#2265
#2269
#2271
#2274
#2275
#2278
#2281
#2297
#23
#2302
#2303
#2304
#2305
#2306
#2309
#2319
#2323
#2324
#2325
#2336
#2337
#2340
#2341
#2346
#2350
#2363
#2371
#2374
#2375
#2376
#2381
#2386
#2393
#2396
#2402
#2411
#2420
#2421
#2426
#2428
#2429
#2431
#2433
#2434
#2446
#2459
#2467
#2472
#2475
#2496
#2497
#2506
#2509
#2512
#2540
#2562
#2572
#2608
#2609
#2613
#2619
#2620
#2625
#2640
#2641
#2642
#2643
#2646
#2647
#2650
#2653
#2655
#2656
#2658
#2660
#2664
#2670
#2672
#2675
#2680
#2681
#2682
#2689
#2690
#2691
#2695
#2700
#2701
#2703
#2704
#2705
#2707
#2711
#2721
#2729
#2730
#2733
#2734
#2735
#2736
#2737
#2738
#2750
#2751
#2754
#2763
#2764
#2766
#2771
#2772
#2773
#2774
#2775
#2780
#2782
#2792
#2793
#2795
#2796
#2799
#2801
#2802
#2803
#2805
#2807
#371
#374
#375
#376
#377
#378
#380
#381
#383
#384
#385
#386
#392
#44
#532
#629
#662
#666
#689
#691
#698
#699
#719
#725
#730
#731
#738
#745
#752
#774
#816
#818
#82
#829
#847
#857
#888
#933
#961
#971
#977
#981
0.9.18
0.9.20
0.9.21
0.9.23
0.9.24
0.9.25
0.9.27
0.9.28
0.9.29
0.9.30
0.9.31
0.9.32
0.9.33
0.9.35
0.9.36
0.9.37
0.9.38
0.9.39
0.9.42
0.9.43
0.9.45
0.9.46
0.9.47
0.9.48
0.9.49
0.9.50
0.9.9
BOB
I2CP
SAM
addressbook
api
apps
blocker
build
console
critical
crypto
data
debian
defect
docker
duplicate
easy-install bundle
enhancement
eventually
general
i2psnark
i2ptunnel
infrastructure
installer
jetty
maintenance
major
minor
misc
naming
netdb
not a bug
not our bug
package
profiles
research
router
soon
streaming
susidns
susimail
systray
task
tests
transport
trivial
tunnels
unconfirmed
undecided
update
utils
website
wontfix
works-for-me
wrapper
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: I2P_Developers/i2p.i2p#416
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Opened 4 years ago
Last modified 21 months ago
#1893opendefect
i2psnark: data loss on restarts
Reported by:zzzOwned by:zzz
Priority:
minor
Milestone:
0.9.30
Component:
apps/i2psnark
Version:
0.9.28
Keywords:
Cc:
Parent Tickets:
Sensitive:
no
Description
http://forum.i2p/viewtopic.php?t=12636
Subtickets
#1903: Way to reproduce issues described in 1893closedzzz#2508: I2PSnark: Torrent metadata is lost on restartclosedzzz
comment:21 Changed 21 months ago by jogger
OK, reappeared on a Mac after a simple restart. Torrents rescanned, metadata such as upload volume lost.
I had recently as a test changed the snark startup delay to 0 after 60 sec which had solved the problem for me in the past.
Noteworthy: This machine is IPv6 only, integrating very, very slowly into the network.
Snark log until checking the first torrent:
router log:
2019/08/15 22:00:13 ERROR [… DirMonitor?] …etManagerFactory: Error creating session for socket manager
comment:20 in reply to: 18 Changed 21 months ago by Reportage
Replying to zzz:
I haven't been monitoring the config files, but I'm assuming the config is overwritten with a new file. When metadata disappears, it doesn't disappear for all torrents at the same time.. sometimes the metadata will disappear for a couple of torrents, leaving the metadata intact for a several others. When the metadata does disappear, everything disappears including any comments associated with the torrent.
comment:19 Changed 21 months ago by jogger
Tried restarts and crashes on a Mac with inactive, leeched torrents only. Found no problems. All metadata such as uploaded volume intact.
Will never again dare to try Snark with torrents freshly created from files with "unsafe" characters though.
comment:18follow-up: 20 Changed 21 months ago by zzz
"gets lost" as in the config file disappears completely, or is overwritten with a fresh config, or is only partially stored, or some particular field is gone, or?
comment:17 Changed 21 months ago by Reportage
Status:infoneeded →
open
Doesn't happen upon every restart, but over time the metadata for individual torrents gets lost.
To reproduce, restart the router with torrents running repeatedly, and sooner or later the meta data will disappear.
comment:16 Changed 21 months ago by zzz
Status:reopened →
infoneeded
Cannot reproduce here, please provide reason for reopening and steps to reproduce with 0.9.41-0 or higher.
comment:15 Changed 22 months ago by Reportage
Resolution:fixedStatus:closed →
reopened
comment:14 Changed 23 months ago by Reportage
Resolution:
→ fixedStatus:reopened →
closed
comment:13 Changed 23 months ago by Reportage
Add a subticket #2508 (I2PSnark: Torrent metadata is lost on restart).
comment:12 Changed 23 months ago by Reportage
Resolution:fixedStatus:closed →
reopened
Still seeing the same metadata loss after the latest fixes have been applied when restarting the router while torrents are running.
comment:11 Changed 23 months ago by zzz
Resolution:
→ fixedSensitive:
unset
Status:testing →
closed
Webapp shutdown was broken again by me in 0.9.38, fixed for 0.9.41, see #2508. Closing this ticket.
comment:10 Changed 4 years ago by zzz
Milestone:0.9.29 →
0.9.30Status:needs_work →
testing
Webapp shutdown was broken by Jetty 9 (0.9.29-4) as reported in comment 8. Good catch!
After that was fixed, all config files for running torrents were being written at shutdown, whether changed or not. This was broken in late 2015, possibly as a temporary thing. Fixed to only write the necessary config files, which will speed up the shutdown. Only write when the storage (i.e. the bitfield) changed, or we uploaded something, so the upload byte count changed.
Also, not directly related to OP's issue, since he's on a Mac, but writing the config files is very slow on Raspberry Pi, made a change in DataHelper? to not sync the file system, which speeds it up by about 2x. I did tests on my macbook, and syncs are very fast, shouldn't be an issue.
All in 0.9.29-14 b2f40838a26c79ba642a60232f1505588783cc12
thanks for testing
comment:9 Changed 4 years ago by zzz
Status:testing →
needs_work
reopening based on comment 8
comment:8 Changed 4 years ago by jogger
The fix described above does not work in all cases.
I did a graceful restart upgrading from 0.9.29-3 to 4 and all config files were dumped out successfully at that time.
Subsequently, config files were written upon creation, deletion and completion of torrents.
I then did a graceful restart in order to upgrade from from 0.9.29-4 to 5 (seeding 99 torrents at that time). Not a single config file was written out. I lost the progress data at least.
Again no config files written upon a graceful restart updating to 0.9.29-6.
Last edited 4 years ago
by jogger
( previous)
( diff)
comment:7 Changed 4 years ago by zzz
Thanks for your comments. Unfortunately, if you think about it, it's impossible to guarantee a consistent, clean state after a kill -9. If you stop code at an arbitrary time, you're going to get arbitrary results. The best we can do is recognize that state on restart and do a rescan. With certain changes such as rewriting the config file after every change, we might make it better… or could we make it worse, by increasing the chance that the config file partially written? I'll think about possible further improvements but no-rescan-ever isn't possible.
comment:6 Changed 4 years ago by jogger
Thanks for your effort. I will test.
However you are clearly describing that a clean shutdown is necessary to avoid torrent rescans at startup. That corresponds to my reports that this bug produces the same symptoms as a machine crash. I propose a real fix for the issue that will survive a "kill -9" by
either writing out the config files frequently with every change
or separating the config files into two (metadata and status) with one that is never touched once the torrent is complete and thus allows a clean reload after a restart.
comment:5 Changed 4 years ago by zzz
Status:accepted →
testing
In 4f859c6acce391a4c0b3bee3bbe96cded077c60f to be 0.9.28-5:
Parallelize the context shutdown tasks, so the jetty shutdown starts sooner
Increase max time for shutdown tasks from 10 sec to 60 sec (120 on ARM)
Change 20 ms delay between unannounces to every 8th unannounce
Even with the previous 20 ms delay in the loop, we should have been able to get almost 500 torrents to shut down cleanly (maybe 450… I think we have Jetty configured to wait a second), so I still don't fully understand what's going on. With this change we should be able to do a clean shutdown with several thousand torrents.
The only thing that's threaded is the unannounces themselves, so even if some of those aren't completed before shutdown, it shouldn't affect the config file.
The torrents are all closing quickly for me, perhaps though it takes longer if a lot of peers are connected.
Opening ticket #1938 for the unsafe character mapping issue.
Logs after change:
comment:4 Changed 4 years ago by zzz
Milestone:undecided →
0.9.29Status:new →
accepted
OK. Thanks for the detailed information.
I think I was confused by your use of the word "corrupted". If a torrent gets rescanned in this scenario, it's probably not that the config file was corrupted or deleted - it probably just didn't get updated (i.e. rewritten) on shutdown. Since the torrent data will then be more recent than the config file, the torrent will be rescanned at the next startup.
In addition, the config file contains the setting on mapping of unsafe characters. Without that file, we make some assumption. We set mapping if we downloaded the torrent; we don't map if we created the torrent. If the torrent just appears in the directory, that's where we don't know what to do. The code may be able to handle this better, not sure. In any case, it's unrelated to the shutdown issue, and I may make a separate ticket for it.
I'll be looking at ways to speed up and parallelize the shutdown, and wait longer for it to complete.
comment:3 Changed 4 years ago by jogger
Status:infoneeded_new →
new
Found better way to reproduce:
Installed new i2p machine, 0% participating traffic, pointed Snark at data dir with 72 torrents already successfully created and seeded on a different machine.
On first start all torrents were scanned. Files with "unsafe" characters were recreated and redownloaded as described in the forum. Torrents without "unsafe" characters were checked 100% complete.
First restart after some hours: All torrents rescanned - obviously all config files corrupted.
Second restart after some more hours: 19 torrents directly loaded, rest rescanned - obviously most config files corrupted.
Third restart after some more hours: 7 torrents directly loaded, rest rescanned - obviously most config files corrupted.
This has been seen on all my i2p machines on wheezy, jessie, stretch and macOS with 4 different HW platforms, all with journaled file systems. Others also have this problem as there are often leechers appearing being 80 - 95% complete on torrents that have been inactive for weeks. This must be previous seeders exposed to the same problem.
Conclusion 1: The "safe" file name mapping causes leechers to create file names different from the original torrent. If the config file of the original torrent gets corrupted, it can only properly be recreated by recreating the .torrent file. Recreating by rescan loses the original names. Possible solution: "Unsafe" file names get renamed before torrent creation.
Conclusion 2: The config file corruption problem caused by crash or by restart without participating tunnels really exists on a variety of platforms and i2p versions. Possible solution: If a torrent is rescanned, check file content against the torrent file, do not trust the config file. Introduce a way of integrity checking for the config files themselves.
I2P version: 0.9.28-0
Java version: Oracle Corporation 1.8.0_25 (Java™ SE Runtime Environment 1.8.0_25-b17)
Wrapper version: 3.5.30
Server version: 8.1.21.v20160908
Servlet version: Jasper JSP 2.1 Engine
JSTL version: standard-taglib 1.2.0
Platform: Mac OS X x86_64 10.12.2
Jcpuid version: 0
Processor: uninitialized (unrecognized)
Jbigi: Native BigInteger? library jbigi not loaded - using pure Java - poor performance may result - see http://i2p-projekt.i2p/jbigi for help
Jbigi version: 0
GMP version: unknown
comment:2 Changed 4 years ago by zzz
Status:new →
infoneeded_new
#1903 describes a way to reproduce, where the per-torrent config files under i2psnark.config.d are deleted. Those config files contain state information including completion and whether to remap filenames to "safe" characters. When the files are deleted, we forget that information. Torrents will be rescanned but we dont guess what the file mapping will be in the absence of a config file.
I don't understand why the config files would be deleted or corrupted on shutdown, I'll try to come up with a theory.
Please provide the info requested over in the forum thread: quote:
Please provide the version information from the top of /logs in the console, and the number of torrents you have running.
comment:1 Changed 4 years ago by jogger
Add a subticket #1903.