Skip to content
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

Frozen string #2465

Closed
freet162 opened this issue Jan 15, 2019 · 10 comments
Closed

Frozen string #2465

freet162 opened this issue Jan 15, 2019 · 10 comments

Comments

@freet162
Copy link

Hi,
Using the trigger agent I have this issue:

                        can't modify frozen String
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/jsonpath-0.9.4/lib/jsonpath.rb:37:in `initialize'
/home/huginn/huginn/lib/utils.rb:90:in `new'
/home/huginn/huginn/lib/utils.rb:90:in `values_at'
/home/huginn/huginn/lib/utils.rb:79:in `value_at'
/home/huginn/huginn/app/models/agents/trigger_agent.rb:75:in `block (2 levels) in receive'
/home/huginn/huginn/app/models/agents/trigger_agent.rb:74:in `map'
/home/huginn/huginn/app/models/agents/trigger_agent.rb:74:in `block in receive'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.1.1/lib/active_record/relation/delegation.rb:41:in `each'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.1.1/lib/active_record/relation/delegation.rb:41:in `each'
/home/huginn/huginn/app/models/agents/trigger_agent.rb:70:in `receive'
/home/huginn/huginn/app/jobs/agent_receive_job.rb:8:in `perform'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.1.1/lib/active_job/execution.rb:39:in `block in perform_now'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/i18n-1.2.0/lib/i18n.rb:284:in `with_locale'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.1.1/lib/active_job/translation.rb:9:in `block (2 levels) in <module:Translation>'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/callbacks.rb:118:in `instance_exec'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.1.1/lib/active_job/logging.rb:26:in `block (4 levels) in <module:Logging>'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/notifications.rb:168:in `block in instrument'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/notifications.rb:168:in `instrument'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.1.1/lib/active_job/logging.rb:25:in `block (3 levels) in <module:Logging>'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.1.1/lib/active_job/logging.rb:46:in `block in tag_logger'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/tagged_logging.rb:71:in `block in tagged'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/tagged_logging.rb:28:in `tagged'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/tagged_logging.rb:71:in `tagged'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.1.1/lib/active_job/logging.rb:46:in `tag_logger'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.1.1/lib/active_job/logging.rb:22:in `block (2 levels) in <module:Logging>'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/callbacks.rb:118:in `instance_exec'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/callbacks.rb:136:in `run_callbacks'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.1.1/lib/active_job/execution.rb:35:in `perform_now'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.1.1/lib/active_job/execution.rb:24:in `block in execute'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.1.1/lib/active_job/railtie.rb:28:in `block (4 levels) in <class:Railtie>'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/execution_wrapper.rb:87:in `wrap'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/reloader.rb:73:in `block in wrap'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/execution_wrapper.rb:87:in `wrap'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/reloader.rb:72:in `wrap'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.1.1/lib/active_job/railtie.rb:27:in `block (3 levels) in <class:Railtie>'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/callbacks.rb:118:in `instance_exec'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1.1/lib/active_support/callbacks.rb:136:in `run_callbacks'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.1.1/lib/active_job/execution.rb:22:in `execute'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.1.1/lib/active_job/queue_adapters/delayed_job_adapter.rb:42:in `perform'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/backend/base.rb:81:in `block in invoke_job'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/backend/base.rb:78:in `invoke_job'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:230:in `block (2 levels) in run'
/usr/local/lib/ruby/2.5.0/timeout.rb:93:in `block in timeout'
/usr/local/lib/ruby/2.5.0/timeout.rb:103:in `timeout'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:230:in `block in run'
/usr/local/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:229:in `run'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:312:in `block in reserve_and_run_one_job'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:312:in `reserve_and_run_one_job'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:213:in `block in work_off'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:212:in `times'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:212:in `work_off'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:175:in `block (4 levels) in start'
/usr/local/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:174:in `block (3 levels) in start'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:173:in `block (2 levels) in start'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:172:in `loop'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:172:in `block in start'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:79:in `block in add'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/home/huginn/huginn/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:171:in `start'
/home/huginn/huginn/lib/delayed_job_worker.rb:6:in `run'
/home/huginn/huginn/app/concerns/long_runnable.rb:71:in `block in run!'

My agent is the following:

{
  "expected_receive_period_in_days": "5",
  "keep_event": "false",
  "rules": [
    {
      "type": "regex",
      "value": "\"Pôle Emploi\"",
      "path": "description|title"
    }
  ],
  "message": "Un article"
}

Thanks a lot
Sincerely

@dsander
Copy link
Collaborator

dsander commented Jan 15, 2019

That is an interesting error, it looks like its a know problem in jsonpath:. I don't think the jsonpath implementation we are using does not support the | operator.

@Skarlso Would it be possible to improve the error message in jsonpath?

@freet162 You can work around it by defining two rules, one for description, one for title and setting the must_match option to 1.

@Skarlso
Copy link
Contributor

Skarlso commented Jan 16, 2019

What the frek? 😱 I'll take a look and fix this ASAP.

@Skarlso
Copy link
Contributor

Skarlso commented Jan 16, 2019

Oh crap. Yeah. I remember. Interesting

@Skarlso
Copy link
Contributor

Skarlso commented Jan 16, 2019

Yeah that's a regex sytanx that jsonpath is not supporting unfortunately. It is supporting or statements in the for of ||. I'll fix the error though.

@freet162
Copy link
Author

By framenting description and title it does work, thanks. I used to do this way that why I did that
Thanks a lot!

@Skarlso
Copy link
Contributor

Skarlso commented Jan 20, 2019

@freet162 @dsander interestingly enough, actually JsonPath does provide regexing like this:
https://github.com/joshbuddy/jsonpath/blob/master/test/test_jsonpath.rb#L495

I wonder why this didn't work?

@Skarlso
Copy link
Contributor

Skarlso commented Jan 20, 2019

Oh... I see. But only in the query. This is about returning either of those fields. Sorry.

@Skarlso
Copy link
Contributor

Skarlso commented Jan 25, 2019

Interesting. This might actually be a Ruby bug in 2.5. It looks like there might be a fix in 2.6 though.

I mean the frozenerror. Not jsonpath failing tell you about unsupported characters. :)

@dsander
Copy link
Collaborator

dsander commented Jan 25, 2019

Nice, I think we could upgrade the docker containers and the manual installation guide to Ruby 2.6, we already run the tests against it on CI.

@Skarlso
Copy link
Contributor

Skarlso commented Jan 25, 2019

@dsander Actually, don't bother. :D I found out that it's also being thrown in 2.1.9 but not as FrozenError but RuntimeError. FrozenError was added later on though but it's just a RuntimeError.

I improved the error handling saying that what character caused it and that it is unsupported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants