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

Delay Agent, undefined method `payload' for nil:NilClass #3315

Closed
tassoman opened this issue Sep 18, 2023 · 6 comments · Fixed by #3352
Closed

Delay Agent, undefined method `payload' for nil:NilClass #3315

tassoman opened this issue Sep 18, 2023 · 6 comments · Fixed by #3352
Labels

Comments

@tassoman
Copy link

I have no clue what's happening, but RSS Agent dies throwing exception.
I'm running the latest docker image.

Exception during check. undefined method `payload' for nil:NilClass: /app/app/models/agents/delay_agent.rb:104:in `block in check'
/app/app/models/agents/delay_agent.rb:102:in `each'
/app/app/models/agents/delay_agent.rb:102:in `each_with_index'
/app/app/models/agents/delay_agent.rb:102:in `check'
/app/app/jobs/agent_check_job.rb:7:in `perform'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/execution.rb:48:in `block in perform_now'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/i18n-1.13.0/lib/i18n.rb:322:in `with_locale'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/translation.rb:9:in `block (2 levels) in <module:Translation>'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `instance_exec'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/zones.rb:66:in `use_zone'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/timezones.rb:9:in `block (2 levels) in <module:Timezones>'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `instance_exec'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/instrumentation.rb:21:in `block in instrument'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:203:in `block in instrument'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb:203:in `instrument'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/instrumentation.rb:31:in `instrument'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/instrumentation.rb:14:in `block (2 levels) in <module:Instrumentation>'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `instance_exec'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/logging.rb:22:in `block in tag_logger'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/tagged_logging.rb:99:in `block in tagged'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/tagged_logging.rb:37:in `tagged'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/tagged_logging.rb:99:in `tagged'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/logging.rb:22:in `tag_logger'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/logging.rb:15:in `block (2 levels) in <module:Logging>'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `instance_exec'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:137:in `run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/execution.rb:47:in `perform_now'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/execution.rb:25:in `block in execute'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/railtie.rb:47:in `block (4 levels) in <class:Railtie>'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/execution_wrapper.rb:91:in `wrap'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/reloader.rb:72:in `block in wrap'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/execution_wrapper.rb:91:in `wrap'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/reloader.rb:71:in `wrap'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/railtie.rb:46:in `block (3 levels) in <class:Railtie>'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `instance_exec'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb:137:in `run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/execution.rb:23:in `execute'
/app/vendor/bundle/ruby/3.2.0/gems/activejob-6.1.7.3/lib/active_job/queue_adapters/delayed_job_adapter.rb:42:in `perform'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/backend/base.rb:81:in `block in invoke_job'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/backend/base.rb:78:in `invoke_job'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:231:in `block (2 levels) in run'
/app/vendor/bundle/ruby/3.2.0/gems/timeout-0.3.2/lib/timeout.rb:189:in `block in timeout'
/app/vendor/bundle/ruby/3.2.0/gems/timeout-0.3.2/lib/timeout.rb:196:in `timeout'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:231:in `block in run'
/usr/local/lib/ruby/3.2.0/benchmark.rb:311:in `realtime'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:230:in `run'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:313:in `block in reserve_and_run_one_job'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:313:in `reserve_and_run_one_job'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:214:in `block in work_off'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:213:in `times'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:213:in `work_off'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:176:in `block (4 levels) in start'
/usr/local/lib/ruby/3.2.0/benchmark.rb:311:in `realtime'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:175:in `block (3 levels) in start'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:174:in `block (2 levels) in start'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:173:in `loop'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:173:in `block in start'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:79:in `block in add'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/3.2.0/gems/delayed_job-4.1.11/lib/delayed/worker.rb:172:in `start'
/app/lib/delayed_job_worker.rb:6:in `run'
/app/app/concerns/long_runnable.rb:71:in `block in run!'
@virtadpt
Copy link
Collaborator

What's the URL to the RSS feed?

@tassoman
Copy link
Author

If I can guess, the payload was empty. So, maybe the feed was unreachable? Or was malformed?
Now I deleted all jobs with errors. I can't reproduce, feeds are running smoothly again.
I have an array of feeds getting parsed by the agent, I can't say which one had errors.
I will say in the future, if will happens again. Maybe I can close this issue for now.

@tassoman
Copy link
Author

I write to reopen this issue, because I ran again in the same error.
This error is about Delay Agent (I'm limiting the flow to 1 rss item per hour)

immagine

I can't get the "event in", should have been a RSS Agent output. Like this

immagine

This is an example of working payload

{
  "id": "https://www.rainews.it/video/2023/09/musk-apre-al-reclutamento-per-neuralink-chip-nel-cervello-volontari-db1285b5-d8dc-43ff-ab70-5100a957c326.html",
  "url": "https://www.rainews.it/video/2023/09/musk-apre-al-reclutamento-per-neuralink-chip-nel-cervello-volontari-db1285b5-d8dc-43ff-ab70-5100a957c326.html",
  "urls": [
    "https://www.rainews.it/video/2023/09/musk-apre-al-reclutamento-per-neuralink-chip-nel-cervello-volontari-db1285b5-d8dc-43ff-ab70-5100a957c326.html"
  ],
  "links": [
    {
      "href": "https://www.rainews.it/video/2023/09/musk-apre-al-reclutamento-per-neuralink-chip-nel-cervello-volontari-db1285b5-d8dc-43ff-ab70-5100a957c326.html"
    }
  ],
  "title": "Musk inizia il reclutamento per Neuralink: ai volontari sarà impiantato un chip nel cervello",
  "description": "Il dispositivo, che registrerà e invierà i segnali cerebrali a un'applicazione, sarà inserito nell'area del cervello che controlla l'intenzione di muoversi",
  "content": "Il dispositivo, che registrerà e invierà i segnali cerebrali a un'applicazione, sarà inserito nell'area del cervello che controlla l'intenzione di muoversi",
  "image": "https://www.rainews.it/dl/img/2023/9/21/1695269994541_TZLOPRPRTRMADPBASEIMAGEXNEURALINKTRIAL.JPG",
  "enclosure": null,
  "authors": [

  ],
  "categories": [
    "Scienza e tecnologia",
    "reclutamento per Neuralink",
    "chip nel cervello",
    "Stati Uniti",
    "Neuralink",
    "Elon Musk"
  ],
  "date_published": "2023-09-21T04:14:00+00:00",
  "last_updated": "2023-09-21T04:14:00+00:00"
}

@tassoman tassoman reopened this Sep 22, 2023
@tassoman tassoman changed the title RSS Agent, undefined method `payload' for nil:NilClass Delay Agent, undefined method `payload' for nil:NilClass Sep 22, 2023
@mightymt
Copy link

I just updated my installation on Heroku from a95c5cc to he newest commit 2d5fcaf and started seeing the same log messages regarding the Delay Agent.

This error seems to occur when the agent's memory contains IDs of events that don't exist any more. After manually deleting the memory of the affected agent it started working normally again.

Previously such IDs were simply ignored by the Delay Agent and didn't cause any issues. It would be great if that behaviour could be restored because currently any incoming events may be emitted 5 times before the job goes to "failed" status.

@mightymt
Copy link

mightymt commented Oct 1, 2023

OK, so I did a little bit more testing. The non-existent events weren't the problem after all.

It actually looks like this error always occurs when the number of events in memory is lower than max_emitted_events (but not when the memory is empty).

@econ1991lyj
Copy link

econ1991lyj commented Oct 22, 2023

now I also struggle in such problem. Is there anyone who can fix this bug of Delay agent?

@MysticalMusings
Copy link

Same here. Is there any way to work around?

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

Successfully merging a pull request may close this issue.

6 participants