New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WeakRef::RefError: Invalid Reference - probably recycled #877

Closed
pmalik56 opened this Issue Jun 28, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@pmalik56

pmalik56 commented Jun 28, 2016

I am not able to get all items using @items.find_all(pattern).

@items.find_all(pattern).size is returns correct size .

each item also able to access.
@items.find_all(pattern)[0]
@items.find_all(pattern)[1]
@items.find_all(pattern)[2]

But I am not getting all the items when doing @items.find_all(pattern) getting below error message

Crashlog created at 2016-06-28 09:47:59 +0300

===== MESSAGE:

WeakRef::RefError: Invalid Reference - probably recycled

===== COMPILATION STACK:

  - [item]   /aihe/ring/index.html (rep default)

===== STACK TRACE:

  0. layout /pages/aihe1.erb:9:in `inspect'
  1. layout /pages/aihe1.erb:9:in `inspect'
  2. layout /pages/aihe1.erb:9:in `inspect'
  3. layout /pages/aihe1.erb:9:in `inspect'
  4. layout /pages/aihe1.erb:9:in `inspect'
  5. layout /pages/aihe1.erb:9:in `inspect'
  6. layout /pages/aihe1.erb:9:in `inspect'
  7. layout /pages/aihe1.erb:9:in `inspect'
  8. layout /pages/aihe1.erb:9:in `inspect'
  9. layout /pages/aihe1.erb:9:in `inspect'
  10. layout /pages/aihe1.erb:9:in `inspect'
  11. layout /pages/aihe1.erb:9:in `inspect'
  12. layout /pages/aihe1.erb:9:in `inspect'
  13. layout /pages/aihe1.erb:9:in `inspect'
  14. layout /pages/aihe1.erb:9:in `inspect'
  15. layout /pages/aihe1.erb:9:in `get_binding'
  16. /usr/local/lib/ruby/2.3.0/erb.rb:864:in `eval'
  17. /usr/local/lib/ruby/2.3.0/erb.rb:864:in `result'
  18. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/filters/erb.rb:32:in `run'
  19. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/compilation/filter.rb:130:in `setup_and_run'
  20. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/services/executor.rb:78:in `layout'
  21. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/compilation/compiler.rb:250:in `block in recalculate_content_for_rep'
  22. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/entities/rule_memory.rb:57:in `block in each'
  23. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/entities/rule_memory.rb:57:in `each'
  24. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/entities/rule_memory.rb:57:in `each'
  25. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/compilation/compiler.rb:245:in `recalculate_content_for_rep'
  26. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/compilation/compiler.rb:220:in `compile_rep'
  27. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/compilation/compiler.rb:193:in `block in compile_reps'
  28. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/services/item_rep_selector.rb:18:in `block in each'
  29. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/services/item_rep_selector.rb:13:in `loop'
  30. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/services/item_rep_selector.rb:13:in `each'
  31. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/compilation/compiler.rb:191:in `compile_reps'
  32. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/compilation/compiler.rb:89:in `run'
  33. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/compilation/compiler.rb:77:in `run_all'
  34. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/base/entities/site.rb:30:in `compile'
  35. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/cli/commands/compile.rb:367:in `block in run'
  36. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/cli/commands/compile.rb:409:in `run_listeners_while'
  37. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/cli/commands/compile.rb:366:in `run'
  38. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/cli/command_runner.rb:12:in `block in call'
  39. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/cli/error_handler.rb:64:in `handle_while'
  40. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/cli/error_handler.rb:22:in `handle_while'
  41. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/cli/command_runner.rb:11:in `call'
  42. /usr/local/lib/ruby/gems/2.3.0/gems/cri-2.7.0/lib/cri/command_dsl.rb:233:in `block in runner'
  43. /usr/local/lib/ruby/gems/2.3.0/gems/cri-2.7.0/lib/cri/command.rb:294:in `run_this'
  44. /usr/local/lib/ruby/gems/2.3.0/gems/cri-2.7.0/lib/cri/command.rb:247:in `run'
  45. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/cli/commands/nanoc.rb:37:in `block in define'
  46. /usr/local/lib/ruby/gems/2.3.0/gems/cri-2.7.0/lib/cri/command.rb:294:in `run_this'
  47. /usr/local/lib/ruby/gems/2.3.0/gems/cri-2.7.0/lib/cri/command.rb:247:in `run'
  48. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/cli.rb:53:in `block in run'
  49. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/cli/error_handler.rb:64:in `handle_while'
  50. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/cli/error_handler.rb:22:in `handle_while'
  51. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib/nanoc/cli.rb:51:in `run'
  52. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/bin/nanoc:9:in `<top (required)>'
  53. /usr/local/bin/nanoc:23:in `load'
  54. /usr/local/bin/nanoc:23:in `<top (required)>'
  55. /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `load'
  56. /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `kernel_load'
  57. /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:24:in `run'
  58. /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli.rb:304:in `exec'
  59. /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  60. /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  61. /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
  62. /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
  63. /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start'
  64. /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>'
  65. /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
  66. /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
  67. /usr/local/bin/bundle:23:in `load'

===== VERSION INFORMATION:

Nanoc 4.2.1 © 2007-2016 Denis Defreyne.
Running ruby 2.3.1 (2016-04-26) on x86_64-linux with RubyGems 2.5.1.

===== SYSTEM INFORMATION:

Linux partha-elisa 4.2.0-38-generic #45~14.04.1-Ubuntu SMP Thu Jun 9 09:27:51 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

===== INSTALLED GEMS:

  adsf 1.2.0
  builder 3.2.2
  bundler 1.12.5
  coderay 1.1.1
  colored 1.2
  commonjs 0.2.7
  cri 2.7.0
  daemons 1.2.3
  diff-lcs 1.2.5
  eventmachine 1.2.0.1
  ffi 1.9.10
  formatador 0.2.5
  guard 2.14.0
  guard-nanoc 1.0.2
  json 1.8.3
  less 2.6.0
  libv8 3.16.14.15
  listen 3.1.5
  lumberjack 1.0.10
  method_source 0.8.2
  mime-types 2.6.1
  mini_portile 0.6.2
  nanoc 4.2.1
  nenv 0.3.0
  nokogiri 1.6.6.2
  notiffany 0.1.0
  pry 0.10.3
  rack 1.6.4
  rb-fsevent 0.9.7
  rb-inotify 0.9.7
  ref 2.0.0
  rspec 2.14.1
  rspec-core 2.14.8
  rspec-expectations 2.14.5
  rspec-mocks 2.14.6
  ruby_dep 1.3.1
  shellany 0.0.1
  slop 3.6.0
  therubyracer 0.12.2
  thin 1.6.3
  thor 0.19.1

===== LOAD PATHS:

  0. /usr/local/lib/ruby/gems/2.3.0/gems/ref-2.0.0/lib
  1. /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib
  2. /usr/local/lib/ruby/gems/2.3.0/gems/thin-1.6.3/lib
  3. /usr/local/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/thin-1.6.3
  4. /usr/local/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.2/lib
  5. /usr/local/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.2/ext
  6. /usr/local/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/therubyracer-0.12.2
  7. /usr/local/lib/ruby/gems/2.3.0/gems/rspec-2.14.1/lib
  8. /usr/local/lib/ruby/gems/2.3.0/gems/rspec-mocks-2.14.6/lib
  9. /usr/local/lib/ruby/gems/2.3.0/gems/rspec-expectations-2.14.5/lib
  10. /usr/local/lib/ruby/gems/2.3.0/gems/rspec-core-2.14.8/lib
  11. /usr/local/lib/ruby/gems/2.3.0/gems/ref-2.0.0/lib
  12. /usr/local/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.6.2/lib
  13. /usr/local/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/nokogiri-1.6.6.2
  14. /usr/local/lib/ruby/gems/2.3.0/gems/mini_portile-0.6.2/lib
  15. /usr/local/lib/ruby/gems/2.3.0/gems/mime-types-2.6.1/lib
  16. /usr/local/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.15-x86_64-linux/lib
  17. /usr/local/lib/ruby/gems/2.3.0/gems/libv8-3.16.14.15-x86_64-linux/ext
  18. /usr/local/lib/ruby/gems/2.3.0/gems/less-2.6.0/lib
  19. /usr/local/lib/ruby/gems/2.3.0/gems/json-1.8.3/lib
  20. /usr/local/lib/ruby/gems/2.3.0/gems/guard-nanoc-1.0.2/lib
  21. /usr/local/lib/ruby/gems/2.3.0/gems/nanoc-4.2.1/lib
  22. /usr/local/lib/ruby/gems/2.3.0/gems/guard-2.14.0/lib
  23. /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib
  24. /usr/local/lib/ruby/gems/2.3.0/gems/pry-0.10.3/lib
  25. /usr/local/lib/ruby/gems/2.3.0/gems/slop-3.6.0/lib
  26. /usr/local/lib/ruby/gems/2.3.0/gems/method_source-0.8.2/lib
  27. /usr/local/lib/ruby/gems/2.3.0/gems/notiffany-0.1.0/lib
  28. /usr/local/lib/ruby/gems/2.3.0/gems/shellany-0.0.1/lib
  29. /usr/local/lib/ruby/gems/2.3.0/gems/nenv-0.3.0/lib
  30. /usr/local/lib/ruby/gems/2.3.0/gems/lumberjack-1.0.10/lib
  31. /usr/local/lib/ruby/gems/2.3.0/gems/listen-3.1.5/lib
  32. /usr/local/lib/ruby/gems/2.3.0/gems/ruby_dep-1.3.1/lib
  33. /usr/local/lib/ruby/gems/2.3.0/gems/rb-inotify-0.9.7/lib
  34. /usr/local/lib/ruby/gems/2.3.0/gems/rb-fsevent-0.9.7/lib
  35. /usr/local/lib/ruby/gems/2.3.0/gems/formatador-0.2.5/lib
  36. /usr/local/lib/ruby/gems/2.3.0/gems/ffi-1.9.10/lib
  37. /usr/local/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/ffi-1.9.10
  38. /usr/local/lib/ruby/gems/2.3.0/gems/eventmachine-1.2.0.1/lib
  39. /usr/local/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/eventmachine-1.2.0.1
  40. /usr/local/lib/ruby/gems/2.3.0/gems/diff-lcs-1.2.5/lib
  41. /usr/local/lib/ruby/gems/2.3.0/gems/daemons-1.2.3/lib
  42. /usr/local/lib/ruby/gems/2.3.0/gems/cri-2.7.0/lib
  43. /usr/local/lib/ruby/gems/2.3.0/gems/commonjs-0.2.7/lib
  44. /usr/local/lib/ruby/gems/2.3.0/gems/colored-1.2/lib
  45. /usr/local/lib/ruby/gems/2.3.0/gems/coderay-1.1.1/lib
  46. /usr/local/lib/ruby/gems/2.3.0/gems/builder-3.2.2/lib
  47. /usr/local/lib/ruby/gems/2.3.0/gems/adsf-1.2.0/lib
  48. /usr/local/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib
  49. /usr/local/lib/ruby/site_ruby/2.3.0
  50. /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux
  51. /usr/local/lib/ruby/site_ruby
  52. /usr/local/lib/ruby/vendor_ruby/2.3.0
  53. /usr/local/lib/ruby/vendor_ruby/2.3.0/x86_64-linux
  54. /usr/local/lib/ruby/vendor_ruby
  55. /usr/local/lib/ruby/2.3.0
  56. /usr/local/lib/ruby/2.3.0/x86_64-linux
@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Jun 28, 2016

Member

Can you share the contents of layouts/pages/aihe1.erb?

Member

ddfreyne commented Jun 28, 2016

Can you share the contents of layouts/pages/aihe1.erb?

@pmalik56

This comment has been minimized.

Show comment
Hide comment
@pmalik56

pmalik56 Jun 28, 2016

In previous nanoc 3.7.5 version when doing @item.children I was getting below list when printing
@item.children (here @item.identifier = "/aihe/ring/" )

[<Nanoc::Item identifier="/aihe/ring/1/" binary?=false>, <Nanoc::Item identifier="/aihe/ring/2/" binary?=false>, <Nanoc::Item identifier="/aihe/ring/3/" binary?=false>]

Whereas In new nanoc version 4.2.1 I tried to get the children using below pattern but when I print the list matching the pattern I am getting error already mentioned above.

<%= @Items.find_all(pattern) %> gives error where pattern is below

here pattern: /aihe/ring/*/index.html and @item.identifier = '/aihe/ring/index.html'

aihe1.erb :

pattern: <%= pattern = @item.identifier.to_s.sub(/[^\/]+$/, '').chop + '/*/index.html' %>
size : <%= @items.find_all(pattern).size %>
childitem1 : <%= @items.find_all(pattern)[0].identifier %>
childitem2 : <%= childitem2 = @items.find_all(pattern)[1].identifier %>
childitem3 : <%= childitem3 = @items.find_all(pattern)[2].identifier  %>
childitems: <%= @items.find_all(pattern) %>

I want to get all the child items and do sort them and add them to the parent item.

pmalik56 commented Jun 28, 2016

In previous nanoc 3.7.5 version when doing @item.children I was getting below list when printing
@item.children (here @item.identifier = "/aihe/ring/" )

[<Nanoc::Item identifier="/aihe/ring/1/" binary?=false>, <Nanoc::Item identifier="/aihe/ring/2/" binary?=false>, <Nanoc::Item identifier="/aihe/ring/3/" binary?=false>]

Whereas In new nanoc version 4.2.1 I tried to get the children using below pattern but when I print the list matching the pattern I am getting error already mentioned above.

<%= @Items.find_all(pattern) %> gives error where pattern is below

here pattern: /aihe/ring/*/index.html and @item.identifier = '/aihe/ring/index.html'

aihe1.erb :

pattern: <%= pattern = @item.identifier.to_s.sub(/[^\/]+$/, '').chop + '/*/index.html' %>
size : <%= @items.find_all(pattern).size %>
childitem1 : <%= @items.find_all(pattern)[0].identifier %>
childitem2 : <%= childitem2 = @items.find_all(pattern)[1].identifier %>
childitem3 : <%= childitem3 = @items.find_all(pattern)[2].identifier  %>
childitems: <%= @items.find_all(pattern) %>

I want to get all the child items and do sort them and add them to the parent item.

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Jul 1, 2016

Member

Is this problem reproducible? Do you consistently get WeakRef::RefError? If so, does it always occur with the same stack trace?

Member

ddfreyne commented Jul 1, 2016

Is this problem reproducible? Do you consistently get WeakRef::RefError? If so, does it always occur with the same stack trace?

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Jul 3, 2016

Member

I’ve discovered the cause of the bug, and a fix is in #897.

Member

ddfreyne commented Jul 3, 2016

I’ve discovered the cause of the bug, and a fix is in #897.

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Jul 3, 2016

Member

Fixed in #897.

Member

ddfreyne commented Jul 3, 2016

Fixed in #897.

@ddfreyne ddfreyne closed this Jul 3, 2016

@ddfreyne ddfreyne added this to the 4.2.3 milestone Jul 3, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment