Search by Page is working well on my site, however, when I run "drush core-cron", I get many errors of this form;

WD search_by_page: Content not rendered (0) - PID (133), path (node/128), language (en)                                                                                                                                  [error]

After I run cron, search results are no longer accurate. I'm wondering if anyone else sees this bug and what it might be due to.

Comments

jhodgdon’s picture

Status: Active » Postponed (maintainer needs more info)

That's odd... Do you see these errors (check the Recent Log Messages report assuming you have the dblog module enabled) when running cron from the Status Report page, or from a scheduled cron run (e.g. via wget), or just from Drush?

somanyfish’s picture

Only from Drush. When cron run as scheduled or manually from the Status Report Page, I do not see any errors.

Please let me know if I can send any info to aid in your debugging.

Thanks!

jhodgdon’s picture

Status: Postponed (maintainer needs more info) » Active

I'll give it a try from my testing box, and if I cannot reproduce your problem, I'll ask for more details. Thanks for reporting this!

somanyfish’s picture

I was incorrect about this error only being thrown when running cron via Drush. Unfortunately, the error seems very intermittent, which probably means I have not yet figured out what triggers it. However, in the past two days, several scheduled cron runs threw these errors. If you have any ideas what I can do to help track this down, it would be much appreciated!

jhodgdon’s picture

Ah, that changes things.

Some background:

Search by Page, each cron run, chooses some (the total number depends on your settings) items to index. It starts with items that have never been indexed, and then it also cycles through previously-indexed items (choosing which ones to cycle through based on your reindexing settings, what has been recently updated, etc.). The error message will tell you which item triggered the error (node/128 in English from the message you pasted above), and also the error code or message (0 in the example above -- that's the number in parens right after "Content not rendered" -- which could be an error message or a number). But an error code of 0 is not very helpful. It just indicates that the page didn't render for an unknown reason.

So I would just check and see if a person of the role you indicated in your settings that you should use for indexing the content on your site can see the pages that are triggering errors. Also, when you go to those pages, check that there is something present in the main page content block (Search by Page looks for the main page content block and indexes that, skipping sidebars, headers, footers, other blocks, etc.).

jhodgdon’s picture

Title: Running cron through drush causes error » Cron reports indexing/rendering errors
Category: bug » support

Update to status/category to reflect my current understanding of this issue...

somanyfish’s picture

Thanks for this helpful info. My Search by Pages search environment is set to use the "Anonymous user" role for indexing. I did check many of the pages listed and they were all visible to anonymous users.

Just to complicate things, the last couple of cron runs instead have been throwing these errors:

Notice: Trying to get property of non-object in node_page_title() (line 2075 of /path/to/site/modules/node/node.module

I would dearly love to track this down. To summarize, here's what I'm observing:

  • Running cron via drush always throws the "WD search_by_page: Content not rendered" error
  • Running cron via admin/config/system/cron never throws either error
  • Running cron via trigger by anonymous user visit sometimes or always throws "Trying to get property of non-object in node_page_title" error
  • Running cron via trigger by logged in user visit sometimes or always throws "WD search_by_page: Content not rendered" error

I am somewhat less certain of the last two points, as it's hard to test them to determine repeatability.

somanyfish’s picture

You got me thinking when you said that Search by Pages looks for the main content block. Since running cron via drush always caused the "WD search_by_page: Content not rendered" error, I could finally track it down. Here's what caused that long list of errors -- on *one* page I didn't include the main content block. I'm using contexts to set up my blocks and one page had a slightly different structure, so I didn't include the main content block. Big mistake! As soon as I put that block in on every page, "drush core-cron" runs with no problem at all.

Thank you for your ideas above. That's gotten rid of one bug. Now, hopefully I can figure out the other one.

somanyfish’s picture

I've done some further sleuthing and I think that the "Trying to get property of non-object in node_page_title" error has nothing to do with Search by Page. Instead, it seems related to Boost, so I'm reporting the bug in that issue queue. Thanks for all of your help.

jhodgdon’s picture

Status: Active » Fixed

OK... I'll go ahead and mark this fixed for the time being then. If you find it isn't Boost, please reopen.

somanyfish’s picture

I may have been incorrect that Boost is to blame for this bug. I'm sorry to be all over the map on this, but it's been hard to debug. I finally figured out that I could temporarily set my site to run cron whenever I visited a page by changing system_run_automated_cron to always run cron, regardless when it was last run. OK, after the should-have-been obvious move of disabling Boost, I still see the bug. However, when I disable Search by Page Nodes, the bug is gone. To be more specific:

  1. Disable Boost
  2. Disable Search By Page Nodes
  3. Set system_run_automated_cron to always run cron
  4. Visit a page on the site (either logged in or anonymous)
  5. Log has a bunch of errors of the form "Content was skipped" which I'm assuming (hoping) are not big deal.
  6. Enable Search by Page Nodes
  7. Visit a page on the site (either logged in or anonymous)
  8. Log has a bunch of errors of the form "Trying to get property of non-object in node_page_title".

The stacktrace in node_page_title when the error is thrown is these functions:

node_page_title, call_user_func_array, _menu_item_localize, _menu_link_translate, _menu_tree_check_access, menu_tree_check_access, menu_build_tree, menu_tree_page_data, menu_tree_add_active_path, menu_tree_build, menu_block_block_view, call_user_func_array, module_invoke, _block_render_blocks, block_list, block_get_blocks_by_region, execute, context_page_build, search_by_page_page_content, search_by_page_update_index, call_user_func_array, module_invoke, search_cron, call_user_func_array, module_invoke, drupal_cron_run, system_run_automated_cron, drupal_page_footer, drupal_deliver_html_page, drupal_deliver_page, menu_execute_active_handler

When I remove all menu blocks from the page, I do not get an error. The call to menu_tree_page_data in menu_tree_add_active_path seems to be the offender.

Any thoughts? I plan on cross-posting this in the Menu Block issue queue, as I have no idea in which module the problem is originating.

somanyfish’s picture

jhodgdon’s picture

Category: support » bug
Status: Fixed » Active

Duh. Yeah, it can't really be related to Boost, because I was able to reproduce your issue on my site.

And I don't think node_page_get_title() is being used improperly. The problem I saw in my tracing was that the node object wasn't getting loaded properly in that localize function. Oh. I just read through that other issue, and yes this is the same issue, but the root of the problem is that the node object is not being loaded in menu_unserialize(), not (as the issue title suggests) that the node_page_get_title() function is being called "improperly". Anyway, that was also a Drupal 6 issue.

So it looks like for some reason that the Menu Blocks module along with Search by Page are for some reason causing the menu's node object not to be loaded properly. I still have no idea why that would be, but it is definitely a bug of some sort. Search by Page does some spoofing when it renders pages for search results, to make Drupal think it is rendering the page that is in the search results, and probably something that Menu Blocks is somehow relying on is not working.

The next thing to test would probably be to put the full menu (rather than using Menu Blocks) in the sidebar and see if those errors are triggered in that case too. And if not, in the debugger see what the difference is between the menu items from the full menu and the menu items in the menu blocks is.

somanyfish’s picture

Thanks for taking a look at this. I did the sleuthing and here's what I observed:

  1. Disable Menu Blocks, run cron via visiting www.example.com/about -- log does not have any errors of the form "Trying to get property of non-object in node_page_title".
  2. Via Context, add a regular menu to www.example.com/about, run cron via visiting visiting www.example.com/about -- log does not have any errors of the form "Trying to get property of non-object in node_page_title".
  3. Enable Menu Blocks, confirm that no menu blocks are on www.example.com/about, run cron via visiting visiting www.example.com/about -- log does not have any errors of the form "Trying to get property of non-object in node_page_title".
  4. Add menu block to www.example.com/about, run cron via visiting visiting www.example.com/about -- log has many errors of the form "Trying to get property of non-object in node_page_title".

The error is initiated by Menu Block's function menu_tree_add_active_path, which calls menu_tree_page_data. When I replace it with a call to menu_tree_all_data, I do not get the error. Both of these functions return the menu tree, but menu_tree_page_data indicates the active trail, which is key to its functionality.

I don't know how this could be a considered a bug in either Search By Page or Menu Block. When Menu Block calls menu_tree_page_data, it uses appropriate arguments and gets a nice result back -- I can't see any problem with the array returned. It's just along the way, the core calls node_page_title improperly. It must have something to do with the spoofing done by Search By Page which you mention, and it'd probably be quicker to fix what's going wrong there than to try to fix core, so I'd like to keep digging.

Can you give me some more info about the spoofing so I can look into that?

Thanks!

jhodgdon’s picture

Status: Active » Closed (duplicate)

The problem is not that node_page_title is being called inappropriately. The problem is that in the menu.inc code, the node object is supposed to be auto-loaded due to the page path being node/ID, and for some reason, the node object is not being loaded.

Ah. I just realized this is the same error as:
#1187776: Use with Menu Block causes PHP notice and active trail problems
I got confused, I had not realized these were two separate issues. There is more debugging information there.

jpcwebb’s picture

Hi, i am getting this error on the v6 branch - are the same root causes applicable?

jhodgdon’s picture

If you are using Menu Block, the issue this is a duplicate of most likely applies to both Drupal 7 and 6:
#1187776: Use with Menu Block causes PHP notice and active trail problems

If you are not using Menu Block, please feel free to file a separate issue with details of what contrib modules you are using and the error message.

This issue here is actually closed.

bevision’s picture

Status: Closed (duplicate) » Needs review

I am using Search by Page, and not Menu Blocks. When I run Cron or do a Search I receive the following:

Notice: Trying to get property of non-object in node_page_title() (line 2075 of /path/modules/node/node.module).

I am running in the following environment:
Drupal 7.12
Database system MySQL, MariaDB, or equivalent OK
Database system version 5.0.92-log OK
Database updates Up to date
PHP 5.2.17
Superfish library Installed
Unicode library PHP Mbstring Extension
Web server Apache
jQuery Update jQuery 1.5.2 and jQuery UI 1.8.11

I am running the following modules:
Advanced help 7.x-1.0
Calendar 7.x-3.2
Chaos tool suite (ctools) 7.x-1.0
Database search 7.x-1.0-beta2
Date 7.x-2.5
Easy Social 7.x-2.8
Entity API 7.x-1.0-rc2
Facet API 7.x-1.0-rc4
Features 7.x-1.0-rc2
Google Analytics 7.x-1.2
jQuery Update 7.x-2.2
Libraries API 7.x-1.0
Noggin 7.x-1.0
Organic groups 7.x-1.3
Panels 7.x-3.2
Profile 2 7.x-1.2
Search API 7.x-1.0
Search by Page 7.x-1.2
Superfish 7.x-1.8
Variable 7.x-1.2
Views 7.x-3.3
Wysiwyg 7.x-2.1
XML sitemap 7.x-2.0-rc1

I really like the search functionality of Search by page, but cannot get past the errors. Can you help?

jhodgdon’s picture

Status: Needs review » Closed (duplicate)

Please open a new issue with that information. This issue is closed and is a duplicate. Your issue is not directly related to this one.