scrapper/postrunner

postrunner import loops forever

Closed this issue · 2 comments

Hello,

I'm running Debian testing and switched to ruby 3.0. This was the occasion to update my old postrunner setup to 1.0.5.
I then tried to import all my .FIT files. When I try to import even a single file (e.g postrunner -v import C2KB2851.FIT), postrunner loops forever and the memory the process is using is increasing regularly. I can stop postrunner using ^C and get the following message (maybe it can help locate the loop)

INFO: New 2022 running speed record for 400 m: 0:02:00
INFO: New all-time running speed record for 500 m: 0:02:30
INFO: New 2022 running speed record for 500 m: 0:02:30
^Clog writing failed. can't be called from trap context
ERROR: undefined method 'est_sweat_loss' for #<Fit4Ruby::Session:0x000055a9a9eb8b08>
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/ActivitySummary.rb:129:in 'summary'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/ActivitySummary.rb:52:in 'to_html'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/ActivityView.rb:79:in 'block (4 levels) in generate_html'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/HTMLBuilder.rb:124:in 'create_node'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/HTMLBuilder.rb:89:in 'method_missing'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/ActivityView.rb:74:in 'block (3 levels) in generate_html'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/HTMLBuilder.rb:124:in 'create_node'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/HTMLBuilder.rb:89:in 'method_missing'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/ActivityView.rb:73:in 'block (2 levels) in generate_html'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/HTMLBuilder.rb:65:in 'body'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/ActivityView.rb:71:in 'block in generate_html'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/View.rb:41:in 'body'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/ActivityView.rb:70:in 'generate_html'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/ActivityView.rb:47:in 'initialize'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/FFS_Activity.rb:248:in 'new'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/FFS_Activity.rb:248:in 'generate_html_report'
xxx/.gem/ruby/3.0.0/gems/perobs-4.3.0/lib/perobs/ObjectBase.rb:57:in 'method_missing'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/FitFileStore.rb:166:in 'add_fit_file'
xxx/.gem/ruby/3.0.0/gems/perobs-4.3.0/lib/perobs/ObjectBase.rb:57:in 'method_missing'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/Main.rb:517:in 'import_fit_file'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/Main.rb:491:in 'process_file'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/Main.rb:474:in 'block in process_files'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/Main.rb:468:in 'each'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/Main.rb:468:in 'process_files'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/Main.rb:354:in 'execute_command'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner/Main.rb:79:in 'main'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner.rb:24:in '<module:PostRunner>'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/lib/postrunner.rb:22:in '<top (required)>'
<internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in 'require'
<internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in 'require'
xxx/.gem/ruby/3.0.0/gems/postrunner-1.0.5/bin/postrunner:4:in '<top (required)>'
xxx/postrunner:25:in 'load'
xxx/postrunner:25:in '<main>'

*******************************************************************************
You have triggered a bug in PostRunner 1.0.5!

The following patch workarounds the problem (just does not use the recent sweat estimation feature ?).

--- ActivitySummary.rb.org	2022-03-17 10:56:04.398977001 +0100
+++ ActivitySummary.rb	2022-03-17 10:56:07.559000828 +0100
@@ -126,9 +126,9 @@
                           { :metric => 'm', :statute => 'ft' }) ])
       t.row([ 'Calories:', "#{session.total_calories} kCal" ])
 
-      if (est_sweat_loss = session.est_sweat_loss)
-        t.row([ 'Est. Sweat Loss:', "#{est_sweat_loss} ml" ])
-      end
+#      if (est_sweat_loss = session.est_sweat_loss)
+#        t.row([ 'Est. Sweat Loss:', "#{est_sweat_loss} ml" ])
+#      end
       t.row([ 'Avg. HR:', session.avg_heart_rate ?
               "#{session.avg_heart_rate} bpm" : '-' ])
       t.row([ 'Max. HR:', session.max_heart_rate ?

Don't hesitate if you need more information.

Thanks.

Looks like you are still using an older version of fit4ruby. Please make sure you only have version 3.9.0 installed as required by the postrunner gem file.