Laragear/Preload

"Can't preload unlinked class"

Closed this issue · 1 comments

PHP & Platform

8.2.6 - Ubuntu 20.04.5 LTS

Database

No response

Laravel version

10.13.5

Have you done this?

  • I have checked my logs and I'm sure is a bug in this package.
  • I can reproduce this bug in isolation (vanilla Laravel install)
  • I can suggest a workaround as a Pull Request

Expectation

When I use this package to generate our preload file, I expect it to just work. Our setup uses a cronjob that runs every hour to trigger the condition instead of the default setup. Our deployment uses a symlink to achieve a blue/green deployment.

Description

I get a lot of logs when reloading the fpm service about Can't preload unlinked class. At some point then there is a fatal error about memory being exhausted.
Is this something that you can explain somehow? Something that you have encountered yourself?

Reproduction

//

Stack trace & logs

[19-Sep-2023 10:00:03] Warning:  Can't preload unlinked class Carbon\MessageFormatter\MessageFormatterMapper: Unknown parent Carbon\MessageFo...
[19-Sep-2023 10:00:03] Warning:  Can't preload unlinked class Carbon\Translator: Unknown parent Carbon\LazyTranslator in /home/forge/deployme...
[19-Sep-2023 10:00:03] Warning:  Can't preload unlinked class Symfony\Component\HttpClient\HttplugClient: Unknown interface Symfony\Component...
[19-Sep-2023 10:00:03] Warning:  Can't preload unlinked class Nyholm\Psr7\Stream: Unknown trait Nyholm\Psr7\StreamTrait in /home/forge/deploy...
[19-Sep-2023 10:00:03] Warning:  Can't preload unlinked class Nuwave\Lighthouse\Support\Contracts\ProvidesSubscriptionResolver@anonymous: Unk...
[19-Sep-2023 11:00:03] Warning:  Can't preload unlinked class Carbon\MessageFormatter\MessageFormatterMapper: Unknown parent Carbon\MessageFo...
[19-Sep-2023 11:00:03] Warning:  Can't preload unlinked class Symfony\Component\HttpClient\HttplugClient: Unknown interface Symfony\Component...
[19-Sep-2023 11:00:03] Warning:  Can't preload unlinked class Carbon\Translator: Unknown parent Carbon\LazyTranslator in /home/forge/deployme...
[19-Sep-2023 11:00:03] Warning:  Can't preload unlinked class Nyholm\Psr7\Stream: Unknown trait Nyholm\Psr7\StreamTrait in /home/forge/deploy...
[19-Sep-2023 11:00:03] Warning:  Can't preload unlinked class Nuwave\Lighthouse\Support\Contracts\ProvidesSubscriptionResolver@anonymous: Unk...
[19-Sep-2023 12:00:03] Warning:  Can't preload unlinked class Carbon\MessageFormatter\MessageFormatterMapper: Unknown parent Carbon\MessageFo...
[19-Sep-2023 12:00:03] Warning:  Can't preload unlinked class Symfony\Component\HttpClient\HttplugClient: Unknown interface Symfony\Component...
[19-Sep-2023 12:00:03] Warning:  Can't preload unlinked class Carbon\Translator: Unknown parent Carbon\LazyTranslator in /home/forge/deployme...
[19-Sep-2023 12:00:03] Warning:  Can't preload unlinked class Nyholm\Psr7\Stream: Unknown trait Nyholm\Psr7\StreamTrait in /home/forge/deploy...
[19-Sep-2023 12:00:03] Warning:  Can't preload unlinked class Nuwave\Lighthouse\Support\Contracts\ProvidesSubscriptionResolver@anonymous: Unk...
[19-Sep-2023 13:00:03] Warning:  Can't preload unlinked class Nyholm\Psr7\Stream: Unknown trait Nyholm\Psr7\StreamTrait in /home/forge/deploy...
[19-Sep-2023 13:00:03] Warning:  Can't preload unlinked class Carbon\MessageFormatter\MessageFormatterMapper: Unknown parent Carbon\MessageFo...
[19-Sep-2023 13:00:03] Warning:  Can't preload unlinked class Symfony\Component\HttpClient\HttplugClient: Unknown interface Symfony\Component...
[19-Sep-2023 13:00:03] Warning:  Can't preload unlinked class Carbon\Translator: Unknown parent Carbon\LazyTranslator in /home/forge/deployme...
[19-Sep-2023 13:00:03] Warning:  Can't preload unlinked class Nuwave\Lighthouse\Support\Contracts\ProvidesSubscriptionResolver@anonymous: Unk...
[19-Sep-2023 14:00:03] Warning:  Can't preload unlinked class Carbon\MessageFormatter\MessageFormatterMapper: Unknown parent Carbon\MessageFo...
[19-Sep-2023 14:00:03] Warning:  Can't preload unlinked class Symfony\Component\HttpClient\HttplugClient: Unknown interface Symfony\Component...
[19-Sep-2023 14:00:03] Warning:  Can't preload unlinked class Carbon\Translator: Unknown parent Carbon\LazyTranslator in /home/forge/deployme...
[19-Sep-2023 14:00:03] Warning:  Can't preload unlinked class Nyholm\Psr7\Stream: Unknown trait Nyholm\Psr7\StreamTrait in /home/forge/deploy...
[19-Sep-2023 14:00:03] Warning:  Can't preload unlinked class Nuwave\Lighthouse\Support\Contracts\ProvidesSubscriptionResolver@anonymous: Unk...
[19-Sep-2023 15:00:03] Warning:  Can't preload unlinked class Nyholm\Psr7\Stream: Unknown trait Nyholm\Psr7\StreamTrait in /home/forge/deploy...
[19-Sep-2023 15:00:03] Warning:  Can't preload unlinked class Carbon\MessageFormatter\MessageFormatterMapper: Unknown parent Carbon\MessageFo...
[19-Sep-2023 15:00:03] Warning:  Can't preload unlinked class Symfony\Component\HttpClient\HttplugClient: Unknown interface Symfony\Component...
[19-Sep-2023 15:00:03] Warning:  Can't preload unlinked class Carbon\Translator: Unknown parent Carbon\LazyTranslator in /home/forge/deployme...
[19-Sep-2023 15:00:03] Warning:  Can't preload unlinked class Nuwave\Lighthouse\Support\Contracts\ProvidesSubscriptionResolver@anonymous: Unk...
[19-Sep-2023 16:00:02] Warning:  Can't preload unlinked class Carbon\MessageFormatter\MessageFormatterMapper: Unknown parent Carbon\MessageFo...
[19-Sep-2023 16:00:02] Warning:  Can't preload unlinked class Symfony\Component\HttpClient\HttplugClient: Unknown interface Symfony\Component...
[19-Sep-2023 16:00:02] Warning:  Can't preload unlinked class Carbon\Translator: Unknown parent Carbon\LazyTranslator in /home/forge/deployme...
[19-Sep-2023 16:00:02] Warning:  Can't preload unlinked class Nyholm\Psr7\Stream: Unknown trait Nyholm\Psr7\StreamTrait in /home/forge/deploy...
[19-Sep-2023 16:00:02] Warning:  Can't preload unlinked class Nuwave\Lighthouse\Support\Contracts\ProvidesSubscriptionResolver@anonymous: Unk...
[19-Sep-2023 16:00:03] Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 3172664 bytes) in Unknown on line ...

It would really help to check if target classes exists, and how are declared.

Whirl it's normal to have some warnings, a memory leak it's not. I could push the file list as JSON or TXT and read each line with a generator to keep memory usage low.