Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This extension single handedly crashed my whole operating system #53

Open
ahmedmagdy11 opened this issue Jun 28, 2021 · 6 comments
Open

Comments

@ahmedmagdy11
Copy link

OS : ubuntu 16.04
I was stuck in this problem for nearly a day. where i would open a laravel project using vscode and it eats all the memory and i've had this extension for a while but i think maybe vscode pushed an update which cause this kind of problem.

@skrskr
Copy link

skrskr commented Jul 13, 2023

I have the same issue ?
If there is solution for this issue ?

@ahmedmagdy11
Copy link
Author

@skrskr i remember that i remove it and the problem was solved.

@skrskr
Copy link

skrskr commented Jul 13, 2023

@skrskr i remember that i remove it and the problem was solved.

@ahmedmagdy11 yes, i removed it also

@skrskr
Copy link

skrskr commented Jul 14, 2023

OS: ubuntu 22.04
PHP: 7.4
Laravel: 6.2
I did alot of investagation in this issue. @ahmedmagdy11
1- Monitoring os process and found the extentaion start process to run php and terminate but there is process still running and this process lead to memory leak and os crash if not killed this process

// ps aux | grep php
sakr       12241 99.1 12.5 2111904 2040144 ?     R    22:23   0:50 php -r define('LARAVEL_START', microtime(true));require_once '/path/to/project/vendor/autoload.php';$app = require_once 'path/to/project/bootstrap/app.php';class VscodeLaravelExtraIntellisenseProvider extends \Illuminate\Support\ServiceProvider{   public function register() {}?public function boot()?{       if (method_exists($this->app['log'], 'setHandlers')) {???$this->app['log']->setHandlers([new \Monolog\Handler\NullHandler()]);??}?}}$app->register(new VscodeLaravelExtraIntellisenseProvider($app));$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);$status = $kernel->handle($input = new Symfony\Component\Console\Input\ArgvInput,new Symfony\Component\Console\Output\ConsoleOutput);echo '___VSCODE_LARAVEL_EXTRA_INSTELLISENSE_OUTPUT___';echo json_encode(['auth' => __('auth'),'pagination' => __('pagination'),'passwords' => __('passwords'),'site' => __('site'),'validation' => __('validation')]);echo '___VSCODE_LARAVEL_EXTRA_INSTELLISENSE_END_OUTPUT___';

2- I start reading extention source code and found that TranslationProvider start this process to read translation files but this process not terminate
3- I opened the site.php translation file and found the developer who write code before make recursive call for translation keyword

// resources/lang/en/site.php
<?php

return [
...
    'validation_errors' => __("site.validation_errors"),
...
];

4- I fixed this file and try again and it works fine now.

// resources/lang/en/site.php
<?php

return [
...
    'validation_errors' => "validation errors message",
...
];

@ahmedmagdy11
Copy link
Author

@skrskr Great job brother.. u can open a PR for this issue and wait for the owner to merge it.
Also feel free to contact me on my mail ahmed.magdy.9611@gmail.com i would like to connect with u over linkedin or any other social platform

@skrskr
Copy link

skrskr commented Jul 16, 2023

@ahmedmagdy11 I think there is no issue with this extention, the issue for this case in my code we using recursive transalation call which lead to memory leak.

<?php

return [
...
    'validation_errors' => __("site.validation_errors"),
...
];

what the extention doing in this case just encode translation file to json and stuck in recursive call to itself untill memory space completed and os crash.

ehco json_encode(["site" => __("site")]);

Hello @amir9480
I don't know if possilbe we can prevent this issue even developer do the same mistake above ?
If you have any idea ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants