Bug #39300

Bug #37574: ReflectionData is not regenerated automatically

blocking ReflectionService: Call to a member function get() on a non-object

Added by Adrian Föder about 3 years ago. Updated almost 3 years ago.

Status:Closed Start date:2012-07-26
Priority:Won't have this time Due date:
Assigned To:- % Done:

0%

Category:Reflection
Target version:TYPO3 Flow Base Distribution - 1.1.1
PHP Version: Complexity:
Has patch:No Affected Flow version:(any)

Description

Most is commented in https://review.typo3.org/#/c/12575/, however a few steps to (hopefully) reproduce:

  • Use a full Phoenix, all on current master, especially with 12575 applied.
  • make sure also the FLOW3 subroutes are included, not only the TYPO3 ones.
  • run `phpunit --debug -c Build/Common/PhpUnit/FunctionalTests.xml Packages/Framework/TYPO3.FLOW3/Tests/Functional/Http/RequestHandlerTest.php`
  • this should result in the message `PHP Fatal error: Call to a member function get() on a non-object in /var/www/Packages/Framework/TYPO3.FLOW3/Classes/Reflection/ReflectionService.php on line 987`.
  • maybe, try to call your frontend without any given route; in my case this results in the same error.

History

#1 Updated by Adrian Föder about 3 years ago

OK, Core\Booting\Scripts.php::initializeReflectionService(), line 319:

$reflectionService->setClassSchemataRuntimeCache($cacheManager->getCache('FLOW3_Reflection_RuntimeClassSchemata'));

that cache is empty in my case; actually, both

/Data/Temporary/Testing/Cache/Data/FLOW3_Reflection_RuntimeClassSchemata/
/Data/Temporary/Testing/Cache/Data/FLOW3_Reflection_RuntimeData/

directories are empty...

Will examine further.

#2 Updated by Adrian Föder about 3 years ago

an additional note; the call stack mentioned in the review; https://raw.github.com/gist/3046718/, looks like it has something to do with Widget stuff which explains why it is so hard to reproduce: it does only occur in the mentioned Functional test; or if your frontend uses Widgets. Both is the case in my case.

#3 Updated by Adrian Föder about 3 years ago

new Stuff: again, the line in question is the following:

1    public function getClassSchema($classNameOrObject) {
2        if (!isset($this->classSchemata[$className])) {
3                // the following get() fails due to "on a non-object" 
4            $this->classSchemata[$className] = $this->classSchemataRuntimeCache->get(str_replace('\\', '_', $className));
5        }

interestingly, the ->classSchemata array is fully empty in that case! Having examined the initialize() and every other method involved, everything looks good regarding the classSchemata being populated with the correct data.

But, when the error happens, the $this->context is TYPO3\FLOW3\Reflection\ReflectionService! also the systemLogger, for example, is empty; which leads me to the conclusion that the initialize() method is not invoked in the error case.
To verify this; I added a protected helper variable that I changed in the initialize() method; and it doesn't become changed -> the initialize() doesn't get executed.

It looks like there are multiple instances of the ReflectionService around, not being all the exact same ones.

#4 Updated by Bastian Waidelich about 3 years ago

Hi Adrian,
I tried to reproduce this, but without success:

If I run the functional test without including the FLOW3 sub routes I get

There was 1 skipped test:

1) TYPO3\FLOW3\Tests\Functional\Http\RequestHandlerTest::httpRequestIsConvertedToAnActionRequestAndDispatchedToTheRespec
tiveController
In this distribution the FLOW3 routes are not included into the global configuration.

OK, but incomplete or skipped tests!
Tests: 1, Assertions: 0, Skipped: 1.

..as expected.
If I include the FLOW3 routes by adding

 1##
 2# FLOW3 subroutes
 3
 4-
 5  name: 'FLOW3'
 6  uriPattern: '<FLOW3Subroutes>'
 7  defaults:
 8    '@format': 'html'
 9  subRoutes:
10    FLOW3Subroutes:
11      package: TYPO3.FLOW3

at the end or beginning of the global Configuration/Routes.yaml I get

Time: 15 seconds, Memory: 49.50Mb

OK (1 test, 1 assertion)

(PHP 5.4, Win7 64bit)

#5 Updated by Adrian Föder about 3 years ago

  • Status changed from New to Needs Feedback
  • Assigned To set to Adrian Föder
  • Priority changed from Must have to Should have

Hi Bastian,
thanks a lot for your testing; I'm also currently just up to find more information about how to reproduce this. The whole thing looks pretty weird...
I'll update as soon as I find some more information.

#6 Updated by Bastian Waidelich about 3 years ago

Adrian Föder wrote:

I'm also currently just up to find more information about how to reproduce this. The whole thing looks pretty weird...
I'll update as soon as I find some more information.

Thank you! It would be really good if we could solve that before 1.1 final..
Maybe the problem is related to some multi threading issue.. What is your setup?

#7 Updated by Adrian Föder about 3 years ago

well, we have a hosted Xen virtual machine; I don't know much further.... what exactly do you want to know?
At my local windows the error so far is also not reproducable, just like yours. Now I'm up to check whether I can reproduce that in a real very fresh environment...

#8 Updated by Adrian Föder about 3 years ago

  • Assigned To changed from Adrian Föder to Bastian Waidelich

ok, with a step-by-step comparison I found out what was triggering the error: it was my ElasticSearch package, to be concrete it was solved when removing these following lines: https://github.com/afoeder/TYPO3.ElasticSearch/blob/master/Classes/Package.php#L37

When looking at it it's obvious that it's very likely because some handling with the object manager at an early step happens.

So what I finally would like to know is, would you say such occurrence would make the initial change breaking, or am I doing something wrong in my code anyways?

#9 Updated by Karsten Dambekalns almost 3 years ago

  • Target version changed from 1.1 to 1.1.1

#10 Updated by Adrian Föder almost 3 years ago

  • Status changed from Needs Feedback to Closed
  • Assigned To deleted (Bastian Waidelich)
  • Priority changed from Should have to Won't have this time

This seems having went away... will observe this of course, but for now disregard this.

Also available in: Atom PDF