Project

General

Profile

Actions

Bug #22643

closed

jetpack "heartbeat" space-used calculation not compatible with S3

Added by Boone Gorges about 1 month ago. Updated about 1 month ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
S3 Uploads
Target version:
Start date:
2025-04-24
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

Peeping Tom Jetpack collects a bunch of information about our installation and sends it back to the mothership. This includes calls to get_space_used(): https://github.com/cuny-academic-commons/cac/blob/e9e68ce56e54e32bc231240e236011b1550d2d15/wp-content/plugins/jetpack/class.jetpack-heartbeat.php#L87 Following the call stack, WP then tries to do file operations on s3:// assets. Our S3 stream wrapper means that these mostly work, but they take forever, and sites with a lot of media can end up triggering massive overhead as we perform operations on remote files.

In a perfect world, we'd nuke Jetpack entirely, or at least disable these "heartbeat" phone-homes. This is probably not possible at the moment, as it will have other side effects.

get_space_used() is only used in a small handful of places, and it's likely to encounter similar problems no matter where it's called. For the moment, I'm going to use the 'pre_get_space_used' filter to short-circuit this calculation.
Actions #1

Updated by Boone Gorges about 1 month ago

  • Category name changed from WordPress Plugins to S3 Uploads
  • Status changed from New to Resolved
Actions #2

Updated by Raymond Hoh about 1 month ago

In a perfect world, we'd nuke Jetpack entirely, or at least disable these "heartbeat" phone-homes.

We should consider wiping out all of Jetpack's Heartbeat stats with their 'jetpack_heartbeat_stats_array' filter: https://github.com/Automattic/jetpack/blob/bf8432d31a1e0633d8ca0a97c4d5fee83d8a1836/projects/packages/connection/src/class-heartbeat.php#L165.

Actions #3

Updated by Boone Gorges about 1 month ago

Yeah, but will this break some wordpress.com interaction? If wordpress.com sees a lot of bad or nonexistent data coming from a site, will it sever the connection or do some other dumb thing? This is not meant as a rhetorical question - maybe you or Jeremy know :-D

Actions

Also available in: Atom PDF