Closed nodiscc closed 4 months ago
Hi, do you have the queue worker running? The import requires a queue job process_torrent to run before the torrent will appear in the app. If you open the Prometheus metrics at /metrics and look for metrics starting 'bitmagnet_queue' you should see at least 1 processed job.
There is also query caching in the web app that can be busted by refreshing the round blue refresh button.
Please let me know if this helped!
Hi,
do you have the queue worker running?
bitmagnet is running with these options, so I guess I do (i have no use for the dht_crawler for now)
$ ./bin/bitmagnet worker run --keys=queue_server --keys=http_server
INFO migrator migrations/migrator.go:68 checking and applying migrations...
INFO migrator migrations/logger.go:33 goose: no migrations to run. current version: 12
WARN tmdb_client tmdb/factory.go:40 you are using the default TMDB api key; TMDB requests will be limited to 1 per second; to remove this warning please configure a personal TMDB api key
INFO worker/worker.go:195 started worker {"key": "queue_server"}
INFO worker/worker.go:195 started worker {"key": "http_server"}
$ cat .config/bitmagnet/config.yml
postgres:
host: 127.0.0.1
name: bitmagnet
password: _________
port: 5432
user: bitmagnet
dht_crawler:
save_files_threshold: 50
scaling_factor: 10
save_pieces: false
log:
level: info
http_server:
options: ["*"]
local_address: ":3333"
Prometheus metrics at /metrics and look for metrics starting 'bitmagnet_queue'
No such metric (Ctrl+F queue
-> no results)
# HELP bitmagnet_dht_ktable_hashes_added Total number of hashes added to routing table.
# TYPE bitmagnet_dht_ktable_hashes_added counter
bitmagnet_dht_ktable_hashes_added 0
# HELP bitmagnet_dht_ktable_hashes_count Number of hashes in routing table.
# TYPE bitmagnet_dht_ktable_hashes_count gauge
bitmagnet_dht_ktable_hashes_count 0
# HELP bitmagnet_dht_ktable_hashes_dropped Total number of hashes dropped from routing table.
# TYPE bitmagnet_dht_ktable_hashes_dropped counter
bitmagnet_dht_ktable_hashes_dropped 0
# HELP bitmagnet_dht_ktable_nodes_added Total number of nodes added to routing table.
# TYPE bitmagnet_dht_ktable_nodes_added counter
bitmagnet_dht_ktable_nodes_added 0
# HELP bitmagnet_dht_ktable_nodes_count Number of nodes in routing table.
# TYPE bitmagnet_dht_ktable_nodes_count gauge
bitmagnet_dht_ktable_nodes_count 0
# HELP bitmagnet_dht_ktable_nodes_dropped Total number of nodes dropped from routing table.
# TYPE bitmagnet_dht_ktable_nodes_dropped counter
bitmagnet_dht_ktable_nodes_dropped 0
# HELP bitmagnet_meta_info_requester_concurrency Number of concurrent meta info requests.
# TYPE bitmagnet_meta_info_requester_concurrency gauge
bitmagnet_meta_info_requester_concurrency 0
# HELP bitmagnet_meta_info_requester_duration_seconds Duration of successful meta info requests in seconds.
# TYPE bitmagnet_meta_info_requester_duration_seconds histogram
bitmagnet_meta_info_requester_duration_seconds_bucket{le="0.005"} 0
bitmagnet_meta_info_requester_duration_seconds_bucket{le="0.01"} 0
bitmagnet_meta_info_requester_duration_seconds_bucket{le="0.025"} 0
bitmagnet_meta_info_requester_duration_seconds_bucket{le="0.05"} 0
bitmagnet_meta_info_requester_duration_seconds_bucket{le="0.1"} 0
bitmagnet_meta_info_requester_duration_seconds_bucket{le="0.25"} 0
bitmagnet_meta_info_requester_duration_seconds_bucket{le="0.5"} 0
bitmagnet_meta_info_requester_duration_seconds_bucket{le="1"} 0
bitmagnet_meta_info_requester_duration_seconds_bucket{le="2.5"} 0
bitmagnet_meta_info_requester_duration_seconds_bucket{le="5"} 0
bitmagnet_meta_info_requester_duration_seconds_bucket{le="10"} 0
bitmagnet_meta_info_requester_duration_seconds_bucket{le="+Inf"} 0
bitmagnet_meta_info_requester_duration_seconds_sum 0
bitmagnet_meta_info_requester_duration_seconds_count 0
# HELP bitmagnet_meta_info_requester_error_total Total number of failed meta info requests.
# TYPE bitmagnet_meta_info_requester_error_total counter
bitmagnet_meta_info_requester_error_total 0
# HELP bitmagnet_meta_info_requester_success_total Total number of successful meta info requests.
# TYPE bitmagnet_meta_info_requester_success_total counter
bitmagnet_meta_info_requester_success_total 0
# HELP bitmagnet_process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE bitmagnet_process_cpu_seconds_total counter
bitmagnet_process_cpu_seconds_total 2.55
# HELP bitmagnet_process_max_fds Maximum number of open file descriptors.
# TYPE bitmagnet_process_max_fds gauge
bitmagnet_process_max_fds 1.048576e+06
# HELP bitmagnet_process_open_fds Number of open file descriptors.
# TYPE bitmagnet_process_open_fds gauge
bitmagnet_process_open_fds 15
# HELP bitmagnet_process_resident_memory_bytes Resident memory size in bytes.
# TYPE bitmagnet_process_resident_memory_bytes gauge
bitmagnet_process_resident_memory_bytes 4.7607808e+07
# HELP bitmagnet_process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE bitmagnet_process_start_time_seconds gauge
bitmagnet_process_start_time_seconds 1.70803358394e+09
# HELP bitmagnet_process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE bitmagnet_process_virtual_memory_bytes gauge
bitmagnet_process_virtual_memory_bytes 1.293160448e+09
# HELP bitmagnet_process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.
# TYPE bitmagnet_process_virtual_memory_max_bytes gauge
bitmagnet_process_virtual_memory_max_bytes 1.8446744073709552e+19
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 4.4093e-05
go_gc_duration_seconds{quantile="0.25"} 6.6235e-05
go_gc_duration_seconds{quantile="0.5"} 7.6203e-05
go_gc_duration_seconds{quantile="0.75"} 0.000112141
go_gc_duration_seconds{quantile="1"} 0.000244087
go_gc_duration_seconds_sum 0.000542759
go_gc_duration_seconds_count 5
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 24
# HELP go_info Information about the Go environment.
# TYPE go_info gauge
go_info{version="go1.21.5"} 1
# HELP go_memstats_alloc_bytes Number of bytes allocated and still in use.
# TYPE go_memstats_alloc_bytes gauge
go_memstats_alloc_bytes 9.357624e+06
# HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed.
# TYPE go_memstats_alloc_bytes_total counter
go_memstats_alloc_bytes_total 1.65468e+07
# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table.
# TYPE go_memstats_buck_hash_sys_bytes gauge
go_memstats_buck_hash_sys_bytes 1.470369e+06
# HELP go_memstats_frees_total Total number of frees.
# TYPE go_memstats_frees_total counter
go_memstats_frees_total 99936
# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata.
# TYPE go_memstats_gc_sys_bytes gauge
go_memstats_gc_sys_bytes 4.499952e+06
# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use.
# TYPE go_memstats_heap_alloc_bytes gauge
go_memstats_heap_alloc_bytes 9.357624e+06
# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used.
# TYPE go_memstats_heap_idle_bytes gauge
go_memstats_heap_idle_bytes 3.104768e+06
# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use.
# TYPE go_memstats_heap_inuse_bytes gauge
go_memstats_heap_inuse_bytes 1.265664e+07
# HELP go_memstats_heap_objects Number of allocated objects.
# TYPE go_memstats_heap_objects gauge
go_memstats_heap_objects 47180
# HELP go_memstats_heap_released_bytes Number of heap bytes released to OS.
# TYPE go_memstats_heap_released_bytes gauge
go_memstats_heap_released_bytes 2.21184e+06
# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system.
# TYPE go_memstats_heap_sys_bytes gauge
go_memstats_heap_sys_bytes 1.5761408e+07
# HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection.
# TYPE go_memstats_last_gc_time_seconds gauge
go_memstats_last_gc_time_seconds 1.7080336948827546e+09
# HELP go_memstats_lookups_total Total number of pointer lookups.
# TYPE go_memstats_lookups_total counter
go_memstats_lookups_total 0
# HELP go_memstats_mallocs_total Total number of mallocs.
# TYPE go_memstats_mallocs_total counter
go_memstats_mallocs_total 147116
# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures.
# TYPE go_memstats_mcache_inuse_bytes gauge
go_memstats_mcache_inuse_bytes 4800
# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system.
# TYPE go_memstats_mcache_sys_bytes gauge
go_memstats_mcache_sys_bytes 15600
# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures.
# TYPE go_memstats_mspan_inuse_bytes gauge
go_memstats_mspan_inuse_bytes 175224
# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system.
# TYPE go_memstats_mspan_sys_bytes gauge
go_memstats_mspan_sys_bytes 179256
# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place.
# TYPE go_memstats_next_gc_bytes gauge
go_memstats_next_gc_bytes 1.6187896e+07
# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations.
# TYPE go_memstats_other_sys_bytes gauge
go_memstats_other_sys_bytes 1.016399e+06
# HELP go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator.
# TYPE go_memstats_stack_inuse_bytes gauge
go_memstats_stack_inuse_bytes 1.015808e+06
# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator.
# TYPE go_memstats_stack_sys_bytes gauge
go_memstats_stack_sys_bytes 1.015808e+06
# HELP go_memstats_sys_bytes Number of bytes obtained from system.
# TYPE go_memstats_sys_bytes gauge
go_memstats_sys_bytes 2.3958792e+07
# HELP go_threads Number of OS threads created.
# TYPE go_threads gauge
go_threads 9
query caching in the web app that can be busted by refreshing the round blue refresh button.
Tried it as well, without result
Hmm I've just tried importing this JSON snippet, using this command:
cat demo.json | curl --verbose -H "Content-Type: application/json" -H "Connection: close" --data-binary @- http://localhost:3333/import
And it's working for me (see screenshot). If you could open the database could you let me know:
Do you see the imported torrent in the torrents
table?
Do you see the associated record in the torrent_contents
table? (the contents of this table is what's displayed in the UI)
Do you see any associated jobs in the queue_jobs
table?
The other issue you linked was resolved several months ago, I'm not aware of any issues with the importer at the moment....
I think this might be a clue from your output above:
1 items imported
* Connection #0 to host bitmagnet.example.org left intact
When I make the request exactly as in the docs I see:
1 items imported
* Closing connection
The importer is expecting lines of JSON. When the connection closes (or after 100 lines) it will flush the current batch in the import and commit the DB transaction. I suspect the connection didn't close and it's sitting waiting for the next line of JSON.
Can you confirm if the command from my previous comment (with the close
header) works? Looks like it might be working but the output can possibly be more helpful in the case of an unclosed connection....
@nodiscc , I've been able to replicate the issue whereby leaving the connection unclosed results in items being left unimported. This is fixed in https://github.com/bitmagnet-io/bitmagnet/pull/138
The fix for this is now available in https://github.com/bitmagnet-io/bitmagnet/releases/tag/v0.7.1
Confirmed fixed! Thanks!
Edit: adding -H "Connection: close"
did not fix the problem before the patch, as this header doesn't have any effects on HTTP/2 connections. I tried downgarding to HTTP/1.1 but the problem was still present despite the connection being apparently closed. The patch fixes it regardless of the HTTP version or closed status of the connection.
Have you checked the roadmap on the website, and existing issues, before opening a dupllcate issue? Yes
Describe the bug
I'm trying to import a torrent manually by POSTing JSON to the
/import
endpoint. Even though bitmagnet returns HTTP 200/success message1 items imported
, nothing gets imported (no items on web interface, no items in database)This is the same symptom as https://github.com/bitmagnet-io/bitmagnet/issues/10
To Reproduce Steps to reproduce the behavior:
transmission-show
or similardemo.json
POST
the json to the/import
endpointlog.level: debug
torrents
andqueue_jobs
database tables, no rows inserted there.Expected behavior
I expect the torrent to be imported with the request mentioned above, especially if the query returns
1 items imported
.General (please complete the following information):
go install
)Additional context Instance behind apache reverse proxy, self-signed certificate, postgresql 15