10up / ElasticPress

A fast and flexible search and query engine for WordPress.
https://elasticpress.io
GNU General Public License v2.0
1.25k stars 311 forks source link

BUG: Upgrade to 4.5.0 indexing Fatal error #3388

Closed ws256 closed 1 year ago

ws256 commented 1 year ago

Describe the bug

Hi! Everything worked correctly before the update. Indexing does not take place either through the dashboard or through the console. I deleted the old index.

Last Sync

2023/03/13 1:59:54 пп (In Progress)

method: WP Dashboard is_full_sync: Yes end_date_time: 2023/03/13 2:49:15 пп total_time: 0 часов, 49 минут, 22 секунды total: 594774 synced: 591750 skipped: 0 failed: 3024 errors: array ( 0 => 'Uncaught TypeError: Unsupported operand types: string * float in /var/www/dev/wp-includes/media.php:457 Stack trace:

0 /var/www/dev/wp-includes/media.php(135): wp_constrain_dimensions()

1 /var/www/dev/wp-includes/media.php(266): image_constrain_size_for_editor()

2 /var/www/dev/wp-includes/media.php(954): image_downsize()

3 /var/www/dev/wp-includes/media.php(1032): wp_get_attachment_image_src()

4 /var/www/dev/wp-includes/post-template.php(1650): wp_get_attachment_image()

5 /var/www/dev/wp-includes/post-template.php(1714): wp_get_attachment_link()

6 /var/www/dev/wp-includes/class-wp-hook.php(308): prepend_attachment()

7 /var/www/dev/wp-includes/plugin.php(205): WP_Hook->apply_filters()

8 /var/www/dev/wp-content/plugins/elasticpress/includes/classes/Indexable/Post/Post.php(505): apply_filters()

9 /var/www/dev/wp-content/plugins/elasticpress/includes/classes/Indexable.php(388): ElasticPress\Indexable\Post\Post->prepare_document()

10 /var/www/dev/wp-content/plugins/elasticpress/includes/classes/IndexHelper.php(651): ElasticPress\Indexable->bulk_index_dynamically()

11 /var/www/dev/wp-content/plugins/elasticpress/includes/classes/IndexHelper.php(433): ElasticPress\IndexHelper->index_next_batch()

12 /var/www/dev/wp-content/plugins/elasticpress/includes/classes/IndexHelper.php(321): ElasticPress\IndexHelper->index_objects()

13 /var/www/dev/wp-content/plugins/elasticpress/includes/classes/IndexHelper.php(89): ElasticPress\IndexHelper->process_sync_item()

14 /var/www/dev/wp-content/plugins/elasticpress/includes/classes/Screen/Sync.php(99): ElasticPress\IndexHelper->full_index()

15 /var/www/dev/wp-includes/class-wp-hook.php(308): ElasticPress\Screen\Sync->action_wp_ajax_ep_index()

16 /var/www/dev/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()

17 /var/www/dev/wp-includes/plugin.php(517): WP_Hook->do_action()

18 /var/www/dev/wp-admin/admin-ajax.php(188): do_action()

19 {main}

thrown', )

Steps to Reproduce

wp elasticpress clear-sync wp elasticpress delete-index wp elasticpress sync

Screenshots, screen recording, code snippet

No response

Environment information

php_version: 8.0.21 memory_limit: 1024M timeout: 300

WordPress and ElasticPress information

wp_version: 6.1.1

Code of Conduct

felipeelia commented 1 year ago

@ws256 please share the entire status report content so we can try to reproduce it on our end. Thanks.

ws256 commented 1 year ago

I reverted to version 4.4.1. Indexing was successful. Attached is the report

WordPress

WordPress Environment

wp_version: 6.1.1 is_multisite: false theme: custom plugins: Classic Editor (1.6.2), Cyr-To-Lat (5.4.0), ElasticPress (4.4.1), Force Regenerate Thumbnails (2.1.1), HTML in Category Descriptions (1.2.3), jQuery Lightbox For Native Galleries (3.2.2), Noindex Links (2.00), Query Monitor (3.11.2), Rename Users (1.2), Reveal IDs (1.5.4), Last Visit (1.0), WordPress Social Login (3.0.4), WP Change Default From Email (1.1.5), WP Crontrol (1.15.1), Yoast SEO (20.2.1) revisions: all

Server Environment

php_version: 8.0.21 memory_limit: 1024M timeout: 300

Indexable Content

post_count: 145 824 page_count: 38 attachment_count: 448 912 post_meta_keys: 24 page_meta_keys: 9 attachment_meta_keys: 3 total-all-post-types: 26

ElasticPress

Settings

host: http://127.0.0.1:9200 index_prefix: per_page: 200 network_active: false

Timeouts

request_timeout: 5 index_document_timeout: 15 bulk_request_timeout: 30

Failed Queries

(2023-03-13 19:33:13)

error: recommended_solution: es_req: POST http://127.0.0.1:9200/dev-user/_bulk query_time: 60.152053833008 wp_args: array ( ) status_code: 200 body: {"index":{"_id":3252862}}

https://dev (2023-03-13 19:32:37)

error: failed to parse field [meta.nickname.double] of type [long] in document with id '3276577'. Preview of field's value: '1.2425465635346352E20' recommended_solution: We did not recognize this error. Please consider opening a GitHub Issue so we can add it to our list of supported errors. es_req: POST http://127.0.0.1:9200/dev-user/_bulk query_time: 58.777093887329 wp_args: array ( ) status_code: 200 body: {"index":{"_id":3276577}} {"ID":3276577,"user_login":"124254656353463523535","user_email":"email@email.com","user_nicename":"124254656353463523535","spam":"","deleted":"","user_status":"0","display_name":"124254656353463523535","user_registered":"2022-08-19 14:23:17","user_url":"","capabilities":{"1":{"roles":["contributor"]}},"meta":{"first_name":[{"value":"","raw":"","boolean":false}],"last_name":[{"value":"","raw":"","boolean":false}],"nickname":[{"value":"124254656353463523535","raw":"124254656353463523535","long":9223372036854775807,"double":1.2425465635346352e+20,"boolean":false,"date":"1970-01-01","datetime":"1970-01-01 00:00:01","time":"00:00:01"}],"description":[{"value":"","raw":"","boolean":false}],"user_points":[{"value":"10","raw":"10","long":10,"double":10,"boolean":false,"date":"1970-01-01","datetime":"1970-01-01 00:00:01","time":"00:00:01"}],"activated":[{"value":"active","raw":"active","boolean":false,"date":"1970-01-01","datetime":"1970-01-01 00:00:01","time":"00:00:01"}]}}

Elasticsearch Indices

dev-post-1

health: yellow status: open index: dev-post-1 uuid: pri: 5 rep: 1 docs.count: 594774 docs.deleted: 8525 store.size: 1.3gb pri.store.size: 1.3gb total_fields_limit: 5000

dev-user

health: yellow status: open index: dev-user uuid: pri: 1 rep: 1 docs.count: 1351310 docs.deleted: 1 store.size: 646.8mb pri.store.size: 646.8mb total_fields_limit:

Last Sync

2023/03/13 6:43:07 пп

method: WP Dashboard end_date_time: 2023/03/13 9:51:41 пп total_time: 3 часа, 8 минут, 35 секунд total: 1946183 synced: 1946084 skipped: 0 failed: 99 errors: array ( 0 => '568951 (User): [mapper_parsing_exception] failed to parse field [meta.nickname.double] of type [long] in document with id \'568951\'. Preview of field\'s value: \'1.111111111111111E27\'', 1 => '567779 (User): [mapper_parsing_exception] failed to parse field [meta.nickname.double] of type [long] in document with id \'567779\'. Preview of field\'s value: \'1.2376453468764688E21\'', 2 => '555421 (User): [mapper_parsing_exception] failed to parse field [meta.nickname.double] of type [long] in document with id \'555421\'. Preview of field\'s value: \'1.2312312312312315E30\'', )

Feature Settings

Autosuggest

active: true autosuggest_selector: endpoint_url: force_inactive: false trigger_ga_event: 0

Post Search

active: true decaying_enabled: 0 force_inactive: false highlight_enabled: 0 highlight_excerpt: 0 highlight_tag: mark synonyms_editor_mode: simple

Protected Content

active: true force_inactive: false

Related Posts

active: true force_inactive: false

Users

active: true force_inactive: false

burhandodhy commented 1 year ago

Hi @ws256,

We are unable to replicate the issue on your end. We believe that there is some code, either in a plugin or theme, that is causing the issue. To narrow down the issue, we suggest activating the default theme on the staging site and disabling the plugins one by one until you find out the root cause of the problem.

Regards, Burhan

ws256 commented 1 year ago

@burhandodhy I made all your recommendations. The problem appears if Protected Content is turned on. See the report:

Successfully

Failed Queries

WordPress

WordPress Environment

wp_version: 6.1.1 home_url: https://dev.local.com site_url: https://dev.local.com is_multisite: false theme: Twenty Twenty (2.1) plugins: ElasticPress (4.5.0) revisions: all

Server Environment

php_version: 8.0.28 memory_limit: 1024M timeout: 300

Indexable Content

Name — https://dev.local.com

post_count: 75 016 page_count: 33 post_meta_keys: 24 page_meta_keys: 9 total-all-post-types: 25 distinct-meta-keys: ads_basecat, ads_flag, ads_plot_compound, ads_plot_format, ads_ratio, file, file_count_download, moderator, views, wpfp_favorites, ljID, ads_url, ratings_average, ratings_score, ratings_users, plot_type, ljxp_comments, ljxp_privacy, ads_files, ads_password, ads_captcha, ads_IP, ep_exclude_from_search, force_ssl_children и force_ssl

ElasticPress

Settings

host: http://127.0.0.1:9200 index_prefix: language: ru_RU per_page: 250 network_active: false

Timeouts

request_timeout: 5 index_document_timeout: 15 bulk_request_timeout: 30

Elasticsearch Indices

devlocalru-post-1

health: yellow status: open index: devlocalru-post-1 uuid: 7ywgXxy1SxSASWN1PUoAzg pri: 5 rep: 1 docs.count: 592591 docs.deleted: 74208 store.size: 1.7gb pri.store.size: 1.7gb total_fields_limit: 5000

Last Sync

2023/03/25 1:40:31 пп

method: WP Dashboard is_full_sync: No end_date_time: 2023/03/25 1:52:40 пп total_time: 0 часов, 12 минут, 10 секунд total: 75049 synced: 75049 skipped: 0 failed: 0 errors: array ( )

Feature Settings

Post Search

active: true decaying_enabled: 0 force_inactive: false highlight_enabled: 0 highlight_excerpt: 0 highlight_tag: mark synonyms_editor_mode: simple


Error

Failed Queries

WordPress

WordPress Environment

wp_version: 6.1.1 home_url: https://dev.local.com site_url: https://dev.local.com is_multisite: false theme: Twenty Twenty (2.1) plugins: ElasticPress (4.5.0) revisions: all

Server Environment

php_version: 8.0.28 memory_limit: 1024M timeout: 300

Indexable Content

Name https://dev.local.com

post_count: 145 824 page_count: 38 attachment_count: 448 900 post_meta_keys: 24 page_meta_keys: 9 attachment_meta_keys: 3 total-all-post-types: 26 distinct-meta-keys: ads_IP, ads_basecat, ads_captcha, ads_files, ads_flag, ads_password, ads_plot_compound, ads_plot_format, ads_ratio, ads_url, ep_exclude_from_search, file, file_count_download, force_ssl, force_ssl_children, ljID, ljxp_comments, ljxp_privacy, moderator, plot_type, ratings_average, ratings_score, ratings_users, views, wpfp_favorites и wph_count_downloads

ElasticPress

Settings

host: http://127.0.0.1:9200 index_prefix: language: ru_RU per_page: 250 network_active: false

Timeouts

request_timeout: 5 index_document_timeout: 15 bulk_request_timeout: 30

Elasticsearch Indices

devlocalru-post-1

health: yellow status: open index: devlocalru-post-1 uuid: 7ywgXxy1SxSASWN1PUoAzg pri: 5 rep: 1 docs.count: 506888 docs.deleted: 0 store.size: 1.2gb pri.store.size: 1.2gb total_fields_limit: 5000

Last Sync

2023/03/25 12:32:34 пп

method: WP Dashboard is_full_sync: Yes end_date_time: 2023/03/25 1:11:13 пп total_time: 0 часов, 38 минут, 39 секунд total: 594762 synced: 591750 skipped: 0 failed: 3012 errors: array ( 0 => 'Uncaught TypeError: Unsupported operand types: string * float in /var/www/dev/wp-includes/media.php:457 Stack trace:

0 /var/www/dev/wp-includes/media.php(135): wp_constrain_dimensions()

1 /var/www/dev/wp-includes/media.php(266): image_constrain_size_for_editor()

2 /var/www/dev/wp-includes/media.php(954): image_downsize()

3 /var/www/dev/wp-includes/media.php(1032): wp_get_attachment_image_src()

4 /var/www/dev/wp-includes/post-template.php(1650): wp_get_attachment_image()

5 /var/www/dev/wp-includes/post-template.php(1714): wp_get_attachment_link()

6 /var/www/dev/wp-includes/class-wp-hook.php(308): prepend_attachment()

7 /var/www/dev/wp-includes/plugin.php(205): WP_Hook->apply_filters()

8 /var/www/dev/wp-content/plugins/elasticpress/includes/classes/Indexable/Post/Post.php(505): apply_filters()

9 /var/www/dev/wp-content/plugins/elasticpress/includes/classes/Indexable.php(388): ElasticPress\Indexable\Post\Post->prepare_document()

10 /var/www/dev/wp-content/plugins/elasticpress/includes/classes/IndexHelper.php(651): ElasticPress\Indexable->bulk_index_dynamically()

11 /var/www/dev/wp-content/plugins/elasticpress/includes/classes/IndexHelper.php(433): ElasticPress\IndexHelper->index_next_batch()

12 /var/www/dev/wp-content/plugins/elasticpress/includes/classes/IndexHelper.php(321): ElasticPress\IndexHelper->index_objects()

13 /var/www/dev/wp-content/plugins/elasticpress/includes/classes/IndexHelper.php(89): ElasticPress\IndexHelper->process_sync_item()

14 /var/www/dev/wp-content/plugins/elasticpress/includes/classes/Screen/Sync.php(99): ElasticPress\IndexHelper->full_index()

15 /var/www/dev/wp-includes/class-wp-hook.php(308): ElasticPress\Screen\Sync->action_wp_ajax_ep_index()

16 /var/www/dev/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()

17 /var/www/dev/wp-includes/plugin.php(517): WP_Hook->do_action()

18 /var/www/dev/wp-admin/admin-ajax.php(188): do_action()

19 {main}

thrown', )

Feature Settings

Post Search

active: true decaying_enabled: 0 force_inactive: false highlight_enabled: 0 highlight_excerpt: 0 highlight_tag: mark synonyms_editor_mode: simple

Protected Content

active: true force_inactive: false

felipeelia commented 1 year ago

Hey @ws256, we've tried several times to reproduce the problem (with and without Protected Content enabled) and unfortunately, we did not have that error. Going through the error trace, it is related to WordPress and its calculations related to images sizes, so I recommend you to run a sync via WP-CLI (wp elasticpress sync --setup --yes) and keep an eye on post IDs to see which one exactly is failing. Looking at that post (and its related images) could give you a hint of what could be going wrong there.

I'm closing the issue for now but feel free to come back here with your findings, okay? Thanks.

ws256 commented 1 year ago

There were problems with indexing attachments of 2010 and older, bmp and gif formats, post_parent=0 Decided to delete from the database.