News: BackgroundJob exception in Media::setUrl()

Created on 8 May 2020  ·  16Comments  ·  Source: nextcloud/news

IMPORTANT

Read and tick the following checkbox after you have created the issue or place an x inside the brackets ;)

Explain the Problem

Error while retrieving RSS/Atom content after update nextcloud and news app.

Steps to Reproduce

Explain what you did to encounter the issue

  1. Run php -f ./cron.php

System Information

  • News app version: 14.1.7
  • Nextcloud version: 18.0.4
  • Cron type: system cron calls cron.php
  • PHP version: 7.3.17
  • Database and version: PostgreSQL 9.6.12
  • Browser and version:
  • Distribution and version:

Contents of nextcloud/data/nextcloud.log

{"reqId":"m0j7lLEMXTVXKI1VJAIY","level":3,"time":"2020-05-08T12:31:33+00:00","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":{"Exception":"TypeError","Message":"Argument 2 passed to FeedIo\\Rule\\Media::setUrl() must be of the type string, null given, called in /var/www/html/custom_apps/news/vendor/debril/feed-io/src/FeedIo/Rule/Media.php on line 68","Code":0,"Trace":[{"file":"/var/www/html/custom_apps/news/vendor/debril/feed-io/src/FeedIo/Rule/Media.php","line":68,"function":"setUrl","class":"FeedIo\\Rule\\Media","type":"->","args":[{"__class__":"FeedIo\\Feed\\Item\\Media"},null,{"__class__":"FeedIo\\Feed\\Item"}]},{"file":"/var/www/html/custom_apps/news/vendor/debril/feed-io/src/FeedIo/Parser/XmlParser.php","line":114,"function":"setProperty","class":"FeedIo\\Rule\\Media","type":"->","args":[{"__class__":"FeedIo\\Feed\\Item"},{"__class__":"DOMElement"}]},{"file":"/var/www/html/custom_apps/news/vendor/debril/feed-io/src/FeedIo/Parser/XmlParser.php","line":95,"function":"handleNode","class":"FeedIo\\Parser\\XmlParser","type":"->","args":[{"__class__":"FeedIo\\Feed\\Item"},{"__class__":"DOMElement"},{"__class__":"FeedIo\\RuleSet"}]},{"file":"/var/www/html/custom_apps/news/vendor/debril/feed-io/src/FeedIo/Parser/XmlParser.php","line":110,"function":"parseNode","class":"FeedIo\\Parser\\XmlParser","type":"->","args":[{"__class__":"FeedIo\\Feed\\Item"},{"__class__":"DOMElement"},{"__class__":"FeedIo\\RuleSet"}]},{"file":"/var/www/html/custom_apps/news/vendor/debril/feed-io/src/FeedIo/Parser/XmlParser.php","line":95,"function":"handleNode","class":"FeedIo\\Parser\\XmlParser","type":"->","args":[{"__class__":"FeedIo\\Feed"},{"__class__":"DOMElement"},{"__class__":"FeedIo\\RuleSet"}]},{"file":"/var/www/html/custom_apps/news/vendor/debril/feed-io/src/FeedIo/Parser/XmlParser.php","line":53,"function":"parseNode","class":"FeedIo\\Parser\\XmlParser","type":"->","args":[{"__class__":"FeedIo\\Feed"},{"__class__":"DOMElement"},{"__class__":"FeedIo\\RuleSet"}]},{"file":"/var/www/html/custom_apps/news/vendor/debril/feed-io/src/FeedIo/ParserAbstract.php","line":70,"function":"parseContent","class":"FeedIo\\Parser\\XmlParser","type":"->","args":[{"__class__":"FeedIo\\Reader\\Document"},{"__class__":"FeedIo\\Feed"}]},{"file":"/var/www/html/custom_apps/news/vendor/debril/feed-io/src/FeedIo/Reader.php","line":164,"function":"parse","class":"FeedIo\\ParserAbstract","type":"->","args":[{"__class__":"FeedIo\\Reader\\Document"},{"__class__":"FeedIo\\Feed"}]},{"file":"/var/www/html/custom_apps/news/vendor/debril/feed-io/src/FeedIo/Reader.php","line":146,"function":"parseDocument","class":"FeedIo\\Reader","type":"->","args":[{"__class__":"FeedIo\\Reader\\Document"},{"__class__":"FeedIo\\Feed"}]},{"file":"/var/www/html/custom_apps/news/vendor/debril/feed-io/src/FeedIo/Reader.php","line":125,"function":"handleResponse","class":"FeedIo\\Reader","type":"->","args":[{"__class__":"FeedIo\\Adapter\\Guzzle\\Response"},{"__class__":"FeedIo\\Feed"}]},{"file":"/var/www/html/custom_apps/news/vendor/debril/feed-io/src/FeedIo/FeedIo.php","line":323,"function":"read","class":"FeedIo\\Reader","type":"->","args":["http://news.sportbox.ru/taxonomy/term/145/0/feed",{"__class__":"FeedIo\\Feed"},{"date":"2020-05-06 20:44:01.000000","timezone_type":2,"timezone":"GMT","__class__":"DateTime"}]},{"file":"/var/www/html/custom_apps/news/vendor/debril/feed-io/src/FeedIo/FeedIo.php","line":338,"function":"read","class":"FeedIo\\FeedIo","type":"->","args":["http://news.sportbox.ru/taxonomy/term/145/0/feed",{"__class__":"FeedIo\\Feed"},{"date":"2020-05-06 20:44:01.000000","timezone_type":2,"timezone":"GMT","__class__":"DateTime"}]},{"file":"/var/www/html/custom_apps/news/lib/Fetcher/FeedFetcher.php","line":88,"function":"readSince","class":"FeedIo\\FeedIo","type":"->","args":["http://news.sportbox.ru/taxonomy/term/145/0/feed",{"date":"2020-05-06 20:44:01.000000","timezone_type":2,"timezone":"GMT","__class__":"DateTime"}]},{"file":"/var/www/html/custom_apps/news/lib/Fetcher/Fetcher.php","line":71,"function":"fetch","class":"OCA\\News\\Fetcher\\FeedFetcher","type":"->","args":["http://news.sportbox.ru/taxonomy/term/145/0/feed",false,"Wed, 06 May 2020 20:44:01 +0000",false,null,null]},{"file":"/var/www/html/custom_apps/news/lib/Service/FeedService.php","line":232,"function":"fetch","class":"OCA\\News\\Fetcher\\Fetcher","type":"->","args":["http://news.sportbox.ru/taxonomy/term/145/0/feed",false,"Wed, 06 May 2020 20:44:01 +0000",false,null,null]},{"file":"/var/www/html/custom_apps/news/lib/Service/FeedService.php","line":187,"function":"update","class":"OCA\\News\\Service\\FeedService","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/news/lib/Utility/Updater.php","line":49,"function":"updateAll","class":"OCA\\News\\Service\\FeedService","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/news/lib/Cron/Updater.php","line":52,"function":"update","class":"OCA\\News\\Utility\\Updater","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\News\\Cron\\Updater","type":"->","args":[null]},{"file":"/var/www/html/cron.php","line":125,"function":"execute","class":"OC\\BackgroundJob\\Job","type":"->","args":[{"__class__":"OC\\BackgroundJob\\JobList"},{"__class__":"OC\\Log"}]}],"File":"/var/www/html/custom_apps/news/vendor/debril/feed-io/src/FeedIo/Rule/Media.php","Line":90,"CustomMessage":"Error while running background job (class: OCA\\News\\Cron\\Updater, arguments: )"},"userAgent":"--","version":"18.0.4.2"}

bug

Most helpful comment

Just released 14.1.8

All 16 comments

Temporary solution for me was

$childElement = $this->getChildAttributeValue($element, 'content', 'url', static::MRSS_NAMESPACE);
if ($childElement !== null ) {
    $this->setUrl($media, $childElement, $node);
}

also can not add this RSS.
The same error:

https://vimeo.com/nlpschool/videos/rss

I am seeing similar behaviour with some of my feeds after upgrading to News 14.1.7 with PHP 7.3.17. It appears that once the cronjob runs into a 'bad' feed, it doesn't just skip that feed, but stops other feeds from being processed. This leaves only some of my feeds getting updated.

Here is a prettyprint formatted log of a 'bad' feed:

$ tail -f nextcloud.log |jq
{
  "reqId": "d3iIHzbEtCb7INmtoU0v",
  "level": 3,
  "time": "2020-05-08T17:36:16+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "core",
  "method": "",
  "url": "--",
  "message": {
    "Exception": "TypeError",
    "Message": "Argument 2 passed to FeedIo\\Rule\\Media::setUrl() must be of the type string, null given, called in /usr/local/www/nextcloud/apps/news/vendor/debril/feed-io/src/FeedIo/Rule/Media.php on line 68",
    "Code": 0,
    "Trace": [
      {
        "file": "/usr/local/www/nextcloud/apps/news/vendor/debril/feed-io/src/FeedIo/Rule/Media.php",
        "line": 68,
        "function": "setUrl",
        "class": "FeedIo\\Rule\\Media",
        "type": "->",
        "args": [
          {
            "__class__": "FeedIo\\Feed\\Item\\Media"
          },
          null,
          {
            "__class__": "FeedIo\\Feed\\Item"
          }
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/vendor/debril/feed-io/src/FeedIo/Parser/XmlParser.php",
        "line": 114,
        "function": "setProperty",
        "class": "FeedIo\\Rule\\Media",
        "type": "->",
        "args": [
          {
            "__class__": "FeedIo\\Feed\\Item"
          },
          {
            "__class__": "DOMElement"
          }
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/vendor/debril/feed-io/src/FeedIo/Parser/XmlParser.php",
        "line": 95,
        "function": "handleNode",
        "class": "FeedIo\\Parser\\XmlParser",
        "type": "->",
        "args": [
          {
            "__class__": "FeedIo\\Feed\\Item"
          },
          {
            "__class__": "DOMElement"
          },
          {
            "__class__": "FeedIo\\RuleSet"
          }
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/vendor/debril/feed-io/src/FeedIo/Parser/XmlParser.php",
        "line": 110,
        "function": "parseNode",
        "class": "FeedIo\\Parser\\XmlParser",
        "type": "->",
        "args": [
          {
            "__class__": "FeedIo\\Feed\\Item"
          },
          {
            "__class__": "DOMElement"
          },
          {
            "__class__": "FeedIo\\RuleSet"
          }
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/vendor/debril/feed-io/src/FeedIo/Parser/XmlParser.php",
        "line": 95,
        "function": "handleNode",
        "class": "FeedIo\\Parser\\XmlParser",
        "type": "->",
        "args": [
          {
            "__class__": "FeedIo\\Feed"
          },
          {
            "__class__": "DOMElement"
          },
          {
            "__class__": "FeedIo\\RuleSet"
          }
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/vendor/debril/feed-io/src/FeedIo/Parser/XmlParser.php",
        "line": 53,
        "function": "parseNode",
        "class": "FeedIo\\Parser\\XmlParser",
        "type": "->",
        "args": [
          {
            "__class__": "FeedIo\\Feed"
          },
          {
            "__class__": "DOMElement"
          },
          {
            "__class__": "FeedIo\\RuleSet"
          }
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/vendor/debril/feed-io/src/FeedIo/ParserAbstract.php",
        "line": 70,
        "function": "parseContent",
        "class": "FeedIo\\Parser\\XmlParser",
        "type": "->",
        "args": [
          {
            "__class__": "FeedIo\\Reader\\Document"
          },
          {
            "__class__": "FeedIo\\Feed"
          }
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/vendor/debril/feed-io/src/FeedIo/Reader.php",
        "line": 164,
        "function": "parse",
        "class": "FeedIo\\ParserAbstract",
        "type": "->",
        "args": [
          {
            "__class__": "FeedIo\\Reader\\Document"
          },
          {
            "__class__": "FeedIo\\Feed"
          }
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/vendor/debril/feed-io/src/FeedIo/Reader.php",
        "line": 146,
        "function": "parseDocument",
        "class": "FeedIo\\Reader",
        "type": "->",
        "args": [
          {
            "__class__": "FeedIo\\Reader\\Document"
          },
          {
            "__class__": "FeedIo\\Feed"
          }
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/vendor/debril/feed-io/src/FeedIo/Reader.php",
        "line": 125,
        "function": "handleResponse",
        "class": "FeedIo\\Reader",
        "type": "->",
        "args": [
          {
            "__class__": "FeedIo\\Adapter\\Guzzle\\Response"
          },
          {
            "__class__": "FeedIo\\Feed"
          }
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/vendor/debril/feed-io/src/FeedIo/FeedIo.php",
        "line": 323,
        "function": "read",
        "class": "FeedIo\\Reader",
        "type": "->",
        "args": [
          "https://invidio.us/feed/channel/UCxS2lX7728bTnmK1t21bYlA",
          {
            "__class__": "FeedIo\\Feed"
          },
          {
            "date": "2020-05-06 20:00:09.000000",
            "timezone_type": 2,
            "timezone": "GMT",
            "__class__": "DateTime"
          }
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/vendor/debril/feed-io/src/FeedIo/FeedIo.php",
        "line": 338,
        "function": "read",
        "class": "FeedIo\\FeedIo",
        "type": "->",
        "args": [
          "https://invidio.us/feed/channel/UCxS2lX7728bTnmK1t21bYlA",
          {
            "__class__": "FeedIo\\Feed"
          },
          {
            "date": "2020-05-06 20:00:09.000000",
            "timezone_type": 2,
            "timezone": "GMT",
            "__class__": "DateTime"
          }
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/lib/Fetcher/FeedFetcher.php",
        "line": 88,
        "function": "readSince",
        "class": "FeedIo\\FeedIo",
        "type": "->",
        "args": [
          "https://invidio.us/feed/channel/UCxS2lX7728bTnmK1t21bYlA",
          {
            "date": "2020-05-06 20:00:09.000000",
            "timezone_type": 2,
            "timezone": "GMT",
            "__class__": "DateTime"
          }
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/lib/Fetcher/Fetcher.php",
        "line": 71,
        "function": "fetch",
        "class": "OCA\\News\\Fetcher\\FeedFetcher",
        "type": "->",
        "args": [
          "https://invidio.us/feed/channel/UCxS2lX7728bTnmK1t21bYlA",
          false,
          "Wed, 06 May 2020 20:00:09 +0000",
          false,
          null,
          null
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/lib/Service/FeedService.php",
        "line": 232,
        "function": "fetch",
        "class": "OCA\\News\\Fetcher\\Fetcher",
        "type": "->",
        "args": [
          "https://invidio.us/feed/channel/UCxS2lX7728bTnmK1t21bYlA",
          false,
          "Wed, 06 May 2020 20:00:09 +0000",
          false,
          null,
          null
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/lib/Service/FeedService.php",
        "line": 187,
        "function": "update",
        "class": "OCA\\News\\Service\\FeedService",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/lib/Utility/Updater.php",
        "line": 49,
        "function": "updateAll",
        "class": "OCA\\News\\Service\\FeedService",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/apps/news/lib/Cron/Updater.php",
        "line": 52,
        "function": "update",
        "class": "OCA\\News\\Utility\\Updater",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/lib/private/BackgroundJob/Job.php",
        "line": 61,
        "function": "run",
        "class": "OCA\\News\\Cron\\Updater",
        "type": "->",
        "args": [
          null
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/cron.php",
        "line": 125,
        "function": "execute",
        "class": "OC\\BackgroundJob\\Job",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\BackgroundJob\\JobList"
          },
          {
            "__class__": "OC\\Log"
          }
        ]
      }
    ],
    "File": "/usr/local/www/nextcloud/apps/news/vendor/debril/feed-io/src/FeedIo/Rule/Media.php",
    "Line": 90,
    "CustomMessage": "Error while running background job (class: OCA\\News\\Cron\\Updater, arguments: )"
  },
  "userAgent": "--",
  "version": "18.0.4.2"
}

Once all the bad feeds are removed, I got a flood old messages from feeds that were not getting previously updated.

@inpu, can you post a diff of your temporary fix?

Also having this issue following the update yesterday
Results in the app failing completely.

Temporary solution for me was

$childElement = $this->getChildAttributeValue($element, 'content', 'url', static::MRSS_NAMESPACE);
if ($childElement !== null ) {
    $this->setUrl($media, $childElement, $node);
}

Which file did you hot fix in the news /apps/news folder to solve this upstream issue with feed-io?

The mentioned hotfix in https://github.com/nextcloud/news/issues/691#issuecomment-625816979 replaces line 68 in apps/news/vendor/debril/feed-io/src/FeedIo/Rule/Media.php.

Alternatively you could replace the setUrl function in line 90 with the hotfix mentioned in the linked issue of feed-io.

It seems to always happen with RSS feeds from Vimeo channels. It happens with https://vimeo.com/petzl/videos/rss too.

You're right, it's the same problem some lines later. I suggest using the alternative hotfix I've mentioned, that should resolve both of them.
I'll update my issue for feed-io.

The mentioned hotfix in #691 (comment) replaces line 68 in apps/news/vendor/debril/feed-io/src/FeedIo/Rule/Media.php.

Alternatively you could replace the setUrl function in line 90 with the hotfix mentioned in the linked issue of feed-io.

Thanks, you are right. Bug actually not in news app, but in 3rd party library.
I think news app also can handle some errors and do not stop processing entire job.
And maybe apply hotfix before feed-io, it can affect a lot of news app users now.

Anyway to roll back to the old version where the third party library isn't broken?

Hi,
The issue is fixed with new version 4.6.1 of feed-io.

@Grotax Can you please release a new version with the updated feed-io library?
thanks @alexdebril for the quick fix.

It seems like @Grotax wants to jump to feed-io 4.7 with 14.1.8, but @SMillerDev didn't do a review yet: https://github.com/nextcloud/news/pull/697

Yea sometimes things take longer that's ok, always remember news is not the most important thing in life, in fact sometimes for me it's at the lowest position, he will do a review when he has time and before that I won't be able to release a new version, that's how the nextcloud organisation works.

Just released 14.1.8

Thanks, the bug is gone and now almost all feeds work once again.

Was this page helpful?
0 / 5 - 0 ratings