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

[Bug]: Error while running background job OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob #46100

Closed
4 of 8 tasks
szaimen opened this issue Jun 25, 2024 · 8 comments · Fixed by #49332
Closed
4 of 8 tasks
Labels
3. to review Waiting for reviews 29-feedback bug feature: carddav Related to CardDAV internals

Comments

@szaimen
Copy link
Contributor

szaimen commented Jun 25, 2024

⚠️ This issue respects the following points: ⚠️

Bug description

Error logged after upgrading to 29.0.3

Steps to reproduce

  1. upgrade to 29.0.3
  2. see error in the logs
{
  "reqId": "625OdztVi2fbvKqsf9dR",
  "level": 3,
  "time": "2024-06-25T10:57:17+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "core",
  "method": "",
  "url": "--",
  "message": "Error while running background job OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob (id: 976, arguments: {\"offset\":0,\"stopAt\":23})",
  "userAgent": "--",
  "version": "29.0.3.4",
  "exception": {
    "Exception": "TypeError",
    "Message": "OCA\\DAV\\CardDAV\\CardDavBackend::getUID(): Argument #1 ($cardData) must be of type string, resource given, called in /var/www/html/apps/dav/lib/CardDAV/CardDavBackend.php on line 708",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/apps/dav/lib/CardDAV/CardDavBackend.php",
        "line": 708,
        "function": "getUID",
        "class": "OCA\\DAV\\CardDAV\\CardDavBackend",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php",
        "line": 90,
        "function": "updateCard",
        "class": "OCA\\DAV\\CardDAV\\CardDavBackend",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php",
        "line": 53,
        "function": "buildIndex",
        "class": "OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob",
        "type": "->",
        "args": [
          23,
          23
        ]
      },
      {
        "file": "/var/www/html/lib/public/BackgroundJob/Job.php",
        "line": 80,
        "function": "run",
        "class": "OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob",
        "type": "->",
        "args": [
          [
            0,
            23
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/public/BackgroundJob/QueuedJob.php",
        "line": 57,
        "function": "start",
        "class": "OCP\\BackgroundJob\\Job",
        "type": "->",
        "args": [
          [
            "OC\\BackgroundJob\\JobList"
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/public/BackgroundJob/QueuedJob.php",
        "line": 47,
        "function": "start",
        "class": "OCP\\BackgroundJob\\QueuedJob",
        "type": "->",
        "args": [
          [
            "OC\\BackgroundJob\\JobList"
          ]
        ]
      },
      {
        "file": "/var/www/html/cron.php",
        "line": 177,
        "function": "execute",
        "class": "OCP\\BackgroundJob\\QueuedJob",
        "type": "->",
        "args": [
          [
            "OC\\BackgroundJob\\JobList"
          ]
        ]
      }
    ],
    "File": "/var/www/html/apps/dav/lib/CardDAV/CardDavBackend.php",
    "Line": 1477,
    "message": "Error while running background job OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob (id: 976, arguments: {\"offset\":0,\"stopAt\":23})",
    "exception": [],
    "CustomMessage": "Error while running background job OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob (id: 976, arguments: {\"offset\":0,\"stopAt\":23})"
  },
  "id": "667aa2fd69054"
}

Expected behavior

should not log an error

Installation method

Official All-in-One appliance

Nextcloud Server version

29

Operating system

None

PHP engine version

None

Web server

None

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

@szaimen szaimen added bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap 29-feedback labels Jun 25, 2024
@ChristophWurst
Copy link
Member

This is similar to #21696. The LONGTEXT column is apparently returned as string|resource but we expect it to always be string

@ashe0047
Copy link

Is there a fix coming soon for this bug?

@kelke
Copy link

kelke commented Sep 21, 2024

I see a check next to nextcloud: increase to 29.0.3 #4886.
image

Does that mean this issue is solved?

@vladbejenaru
Copy link

vladbejenaru commented Sep 24, 2024

Does that mean this issue is solved?

This just completed the my collection of errors on a fresh upgrade to 29.0.6... tbh the other errors were on the 29.0.3... this is new ;-)

Running Nextcloud AIO, thinking to nuke it and to install it anew.... :(

@AdamB2023
Copy link

I'm also having this issue with recent version:

TypeError
OCA\DAV\CardDAV\CardDavBackend::getUID(): Argument #1 ($cardData) must be of type string, resource given, called in /var/www/html/apps/dav/lib/CardDAV/CardDavBackend.php on line 708
Error while running background job OCA\DAV\Migration\BuildSocialSearchIndexBackgroundJob (id: 1391, arguments: {"offset":0,"stopAt":18})

@wolandtel
Copy link
Contributor

wolandtel commented Nov 15, 2024

Still actual for 30.0.2:

Background job OC\Core\BackgroundJobs\GenerateMetadataJob (id: 3466, arguments: null) ran for 16934 seconds 2024-11-15T02:09:39+00:00
TypeError: OCA\DAV\CardDAV\CardDavBackend::getUID(): Argument #1 ($cardData) must be of type string, resource given, called in 2024-11-15T06:16:04+00:00
/var/www/s.woland.me/apps/dav/lib/CardDAV/CardDavBackend.php on line 680 at apps/dav/lib/CardDAV/CardDavBackend.php line 1449

@wolandtel
Copy link
Contributor

Looks like this should solve the problem. I'll wait for next cron job start.

--- apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob-orig.php 2024-11-15 18:33:06.664205182 +0500
+++ apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php  2024-11-15 18:35:09.134761969 +0500
@@ -71,7 +71,11 @@
        // refresh identified contacts in order to re-index
        foreach ($social_cards as $contact) {
            $offset = $contact['id'];
-           $this->davBackend->updateCard($contact['addressbookid'], $contact['uri'], $contact['carddata']);
+           $data = $contact['carddata'];
+           if (is_resource($data) && (get_resource_type($data) == 'stream')) {
+               $data = stream_get_contents($data);
+           }   
+           $this->davBackend->updateCard($contact['addressbookid'], $contact['uri'], $data);
 
            // stop after 15sec (to be continued with next chunk)
            if (($this->time->getTime() - $startTime) > 15) {

wolandtel added a commit to wolandtel/nextcloud-server that referenced this issue Nov 16, 2024
Check if oc_cards.carddata has been read as resource and read it to string.

Signed-off-by: Mikhail Kotelnikov <fox@woland.me>
@solracsf solracsf changed the title [Bug]: Error while running background job OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob [Bug]: Error while running background job OCA\\DAV\\Migration\\BuildSocialSearchIndexBackgroundJob Nov 16, 2024
@joshtrichards joshtrichards added feature: carddav Related to CardDAV internals 3. to review Waiting for reviews and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Nov 18, 2024
backportbot bot pushed a commit that referenced this issue Nov 19, 2024
Fixes #46100

Co-authored-by: Christoph Wurst <ChristophWurst@users.noreply.github.com>
Signed-off-by: Mikhail Kotelnikov <fox@woland.me>
backportbot bot pushed a commit that referenced this issue Nov 19, 2024
Fixes #46100

Co-authored-by: Christoph Wurst <ChristophWurst@users.noreply.github.com>
Signed-off-by: Mikhail Kotelnikov <fox@woland.me>
backportbot bot pushed a commit that referenced this issue Nov 20, 2024
Fixes #46100

Co-authored-by: Christoph Wurst <ChristophWurst@users.noreply.github.com>
Signed-off-by: Mikhail Kotelnikov <fox@woland.me>
@szaimen
Copy link
Contributor Author

szaimen commented Nov 20, 2024

🎉🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews 29-feedback bug feature: carddav Related to CardDAV internals
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants