hook_boot() not invoked on uncached page views if cache mode is AGGRESSIVE

gpk - October 20, 2008 - 00:27
Project:Drupal
Version:6.x-dev
Component:base system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Looks like this was introduced when fixing #182675: Normal page caching disables hook_boot() and hook_exit().

#17 in that issue also points out that the loading of module.inc was moved. Since it's not needed for a page served from the cache when in aggressive mode, this patch also fixes that (=> should give minor performance improvment. Note that 5.x similarly has module.inc included just before http://api.drupal.org/api/function/bootstrap_invoke_all/5 in http://api.drupal.org/api/function/_drupal_cache_init/5).

AttachmentSize
hook_boot_aggressive.patch1.01 KB
Testbed results
hook_boot_aggressive.patchfailedFailed: Failed to apply patch. a href=http://testing.drupal.org/pifr/file/1/hook_boot_aggressive.patchDetailed results/a

#1

gpk - October 22, 2008 - 21:59
Status:active» needs review

Oh yes there's a patch here ;)

#2

Anonymous (not verified) - November 10, 2008 - 12:40
Status:needs review» needs work

The last submitted patch failed testing.

#3

gpk - November 10, 2008 - 14:38

I assume the test system doesn't like the CRs I seem to get running diff on Win?
Trying again..

Bug also present in 6.x BTW.

AttachmentSize
hook_boot_aggressive_0.patch 1018 bytes
Testbed results
hook_boot_aggressive_0.patchfailedFailed: Failed to apply patch. a href=http://testing.drupal.org/pifr/file/1/hook_boot_aggressive_0.patchDetailed results/a

#4

gpk - November 10, 2008 - 14:38
Status:needs work» needs review

#5

Dave Reid - November 11, 2008 - 23:25

I can confirm this behavior. If cache is set aggressive and a user is logged in, hook_boot() will not fire but hook_exit() will. Note, this patch also skips loading the './includes/module.inc' if the page has been cached.

Patches attached for D6 and D7 revised from #3 to not change the comment about loading the page cache.

AttachmentSize
323474-hook-boot-d6.patch 1.19 KB
323474-hook-boot-d7.patch 1.09 KB

#6

gpk - November 11, 2008 - 23:04

@5: Thanks for reinstating the comment before the module.inc line, omitted in error. Very minor point but not sure why you've reverted the comment about loading the page cache?

#7

Anonymous (not verified) - November 13, 2008 - 19:50
Status:needs review» needs work

The last submitted patch failed testing.

#8

Dave Reid - November 13, 2008 - 21:22
Status:needs work» needs review

Sigh...that's the not last submitted patch.

#9

Anonymous (not verified) - November 13, 2008 - 21:25
Status:needs review» needs work

The last submitted patch failed testing.

#10

Dave Reid - November 13, 2008 - 21:32
Status:needs work» needs review

Comon testing bot...let's not fight. If anyone from testing.d.org reads, please see why the patch from #5 is not considered 'the last test' and is not being tested?

#11

Anonymous (not verified) - November 13, 2008 - 21:35
Status:needs review» needs work

The last submitted patch failed testing.

#12

catch - November 13, 2008 - 22:58

-d6.patch shouldn't get tested. -d7.patch probably should, but I wonder if it's getting caught by the same regexp. Easy way to find out.

AttachmentSize
323474-hook-boot.patch 1.09 KB
Testbed results
323474-hook-boot.patchre-testing

#13

catch - November 13, 2008 - 22:58
Status:needs work» needs review

#14

gpk - November 13, 2008 - 23:37

#12 now showing in the queue http://testing.drupal.org/pifr/node/1/323474. So maybe it did get caught by the regex.

#15

hunmonk - November 14, 2008 - 00:26

d.o experienced some database issues earlier today, and i'm guessing 323474-hook-boot-d7.patch in #5 got lost in the fray.

i've re-tested our regex, and it does allow -d7.patch extensions to be submitted for testing, so chalk this one up to a freak accident.

#16

System Message - November 16, 2008 - 22:05
Status:needs review» needs work

The last submitted patch failed testing.

#17

Dave Reid - November 17, 2008 - 03:57
Status:needs work» needs review

Failed due to #74645: modify file_scan_directory to include a regex for the nomask.. Setting back to code needs review.

#18

Dave Reid - November 20, 2008 - 16:28

Reposting patches (D7 had a small offset) so I can get a green light from testing.d.org and hopefully get this committed soon. It's an easy fix.

AttachmentSize
323474-hook-boot-D7.patch 1.06 KB
323474-hook-boot-D6.patch 1.19 KB
Testbed results
323474-hook-boot-D7.patchpassedPassed: 7330 passes, 0 fails, 0 exceptions Detailed results

#19

catch - November 22, 2008 - 01:22

Could we write a simpletest for this - enable aggressive caching, make sure cache is clear, module which implements hook_boot, watch everything blow up?

#20

Dave Reid - November 22, 2008 - 01:35
Status:needs review» needs work

Sure thing...let me get one written quick. Will repost patch with test.

#21

Dave Reid - November 22, 2008 - 02:38
Status:needs work» needs review

There we are! Simple little test included that passes 100% (and would have 1 failure without the patch). Note that the D6 patch is still valid in #18.

AttachmentSize
323474-hook-boot-D7.patch 5.4 KB
Testbed results
323474-hook-boot-D7.patchpassedPassed: 7349 passes, 0 fails, 0 exceptions a href=http://testing.drupal.org/pifr/file/1/323474-hook-boot-D7_1.patchDetailed results/a

#22

catch - November 22, 2008 - 10:40
Status:needs review» reviewed & tested by the community

Patch looks good, tests pass. Re-rolled only with extraneous phpdoc removed + a line added for the new class. No credit on commit please.

AttachmentSize
323474-hook-boot-D7_1.patch 6.57 KB
Testbed results
323474-hook-boot-D7_1.patchpassedPassed: 7391 passes, 0 fails, 0 exceptions Detailed results

#23

Dries - November 22, 2008 - 13:33
Version:7.x-dev» 6.x-dev

I've committed this to CVS HEAD. I assume that the DRUPAL-6 patch should also go in still?

#24

gpk - November 22, 2008 - 14:07
Version:6.x-dev» 7.x-dev

@23: Yes, #18 still good for D6.

Attached followup patch corrects a garbled comment in the tests, plus a couple of other doc tweaks in the tests.. temporarily resetting version..

(@21: Cool, I was wondering how this could be tested.)

[update: patch removed]

#25

gpk - November 22, 2008 - 14:11

Proper patch this time..

AttachmentSize
323474-hook-boot-D7-followup_0.patch 1.84 KB

#26

webchick - November 22, 2008 - 15:30
Version:7.x-dev» 6.x-dev

Doc cleanup committed to D7.

Moving back to D6 for consideration of #18.

#27

Dave Reid - December 14, 2008 - 22:05

Patch in #18 still applies to latest 6.x and is ready to be committed.

#28

Gábor Hojtsy - January 6, 2009 - 17:14
Status:reviewed & tested by the community» fixed

Committed to Drupal 6.x as well.

#29

System Message - January 20, 2009 - 17:20
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.