astorm / MagentoTarToConnect

A small shell script to automatically package tar archives into Magento's Connect 2.0 format.
80 stars 24 forks source link

Script freezes up, and keeps running while using up all remaining memory #21

Open jmshelby opened 10 years ago

jmshelby commented 10 years ago

When I try running this script (as the phar packaged on master), it seems to get past untar'ing, and then either freezes up, or goes into an endless loop where all my memory get's taken up and I have to kill the process. No sign of any package or output file getting created.

Here is the output of packaging up astorm/PulsestormLauncher (as a quick example):

jmshelby@jbook:~/WSS/scratch/PulsestormLauncher> ./build_launcher.bash 
a app/code/community/Pulsestorm/Launcher
a app/code/community/Pulsestorm/Launcher/Block
a app/code/community/Pulsestorm/Launcher/controllers
a app/code/community/Pulsestorm/Launcher/etc
a app/code/community/Pulsestorm/Launcher/Helper
a app/code/community/Pulsestorm/Launcher/Model
a app/code/community/Pulsestorm/Launcher/README.md
a app/code/community/Pulsestorm/Launcher/Model/Links.php
a app/code/community/Pulsestorm/Launcher/Model/Observer.php
a app/code/community/Pulsestorm/Launcher/Helper/Data.php
a app/code/community/Pulsestorm/Launcher/etc/adminhtml.xml
a app/code/community/Pulsestorm/Launcher/etc/config.xml
a app/code/community/Pulsestorm/Launcher/etc/system.xml
a app/code/community/Pulsestorm/Launcher/controllers/Pulsestorm
a app/code/community/Pulsestorm/Launcher/controllers/Pulsestorm/LauncherController.php
a app/code/community/Pulsestorm/Launcher/Block/Breadcrumbs.php
a app/code/community/Pulsestorm/Launcher/Block/Page
a app/code/community/Pulsestorm/Launcher/Block/Page/Menu.php
a app/design/adminhtml/default/default/template/pulsestorm_launcher
a app/design/adminhtml/default/default/template/pulsestorm_launcher/hook.phtml
a app/design/adminhtml/default/default/template/pulsestorm_launcher/js-nav.phtml
a app/etc/modules/Pulsestorm_Launcher.xml
a skin/adminhtml/default/default/pulsestorm_launcher
a skin/adminhtml/default/default/pulsestorm_launcher/main.css
jmshelby@jbook:~/WSS/scratch/PulsestormLauncher> tree
.
├── README.md
├── app
│   ├── code
│   │   └── community
│   │       └── Pulsestorm
│   │           └── Launcher
│   │               ├── Block
│   │               │   ├── Breadcrumbs.php
│   │               │   └── Page
│   │               │       └── Menu.php
│   │               ├── Helper
│   │               │   └── Data.php
│   │               ├── Model
│   │               │   ├── Links.php
│   │               │   └── Observer.php
│   │               ├── README.md
│   │               ├── controllers
│   │               │   └── Pulsestorm
│   │               │       └── LauncherController.php
│   │               └── etc
│   │                   ├── adminhtml.xml
│   │                   ├── config.xml
│   │                   └── system.xml
│   ├── design
│   │   └── adminhtml
│   │       └── default
│   │           └── default
│   │               └── template
│   │                   └── pulsestorm_launcher
│   │                       ├── hook.phtml
│   │                       └── js-nav.phtml
│   └── etc
│       └── modules
│           └── Pulsestorm_Launcher.xml
├── build_launcher.bash
├── magento-tar-to-connect.launcher.php
├── magento-tar-to-connect.phar
├── modman
├── skin
│   └── adminhtml
│       └── default
│           └── default
│               └── pulsestorm_launcher
│                   └── main.css
└── var
    ├── build
    │   └── Pulsestorm_Launcher.tar
    └── package

28 directories, 20 files
jmshelby@jbook:~/WSS/scratch/PulsestormLauncher> cat magento-tar-to-connect.launcher.php 
<?php
return array(
'base_dir'               => 'var/build',
'archive_files'          => 'Pulsestorm_Launcher.tar',
'extension_name'         => 'Pulsestorm_Launcher',
'extension_version'      => '1.0.4',
'path_output'            => 'var/package',

'stability'              => 'stable',
'license'                => 'MIT',
'channel'                => 'community',
'summary'                => 'Provides navigation shortcuts for the admin console\'s navigation and gloal search',
'description'            => 'This extension provides Magento admin console users with an "application launcher". This application launcher provides instant access to the admin console\'s navigation, every system configuration search section, as well as the Magento global search.  The Pulse Storm launcher is a free, open source, must have extension for anyone working with Magento. ',
'notes'                  => 'Typo fixes, properly aborts ajax requests.',

'author_name'            => 'Alan Storm',
'author_user'            => 'alanstorm',
'author_email'           => 'someone@someplace.com',
'php_min'                => '5.2.0',
'php_max'                => '6.0.0',
'skip_version_compare'   => false,
);
jmshelby@jbook:~/WSS/scratch/PulsestormLauncher> ./magento-tar-to-connect.phar magento-tar-to-connect.launcher.php 
x app/code/community/Pulsestorm/Launcher/
x app/code/community/Pulsestorm/Launcher/Block/
x app/code/community/Pulsestorm/Launcher/controllers/
x app/code/community/Pulsestorm/Launcher/etc/
x app/code/community/Pulsestorm/Launcher/Helper/
x app/code/community/Pulsestorm/Launcher/Model/
x app/code/community/Pulsestorm/Launcher/README.md
x app/code/community/Pulsestorm/Launcher/Model/Links.php
x app/code/community/Pulsestorm/Launcher/Model/Observer.php
x app/code/community/Pulsestorm/Launcher/Helper/Data.php
x app/code/community/Pulsestorm/Launcher/etc/adminhtml.xml
x app/code/community/Pulsestorm/Launcher/etc/config.xml
x app/code/community/Pulsestorm/Launcher/etc/system.xml
x app/code/community/Pulsestorm/Launcher/controllers/Pulsestorm/
x app/code/community/Pulsestorm/Launcher/controllers/Pulsestorm/LauncherController.php
x app/code/community/Pulsestorm/Launcher/Block/Breadcrumbs.php
x app/code/community/Pulsestorm/Launcher/Block/Page/
x app/code/community/Pulsestorm/Launcher/Block/Page/Menu.php
x app/design/adminhtml/default/default/template/pulsestorm_launcher/
x app/design/adminhtml/default/default/template/pulsestorm_launcher/hook.phtml
x app/design/adminhtml/default/default/template/pulsestorm_launcher/js-nav.phtml
x app/etc/modules/Pulsestorm_Launcher.xml
x skin/adminhtml/default/default/pulsestorm_launcher/
x skin/adminhtml/default/default/pulsestorm_launcher/main.css
^C
jmshelby@jbook:~/WSS/scratch/PulsestormLauncher> 
jmshelby@jbook:~/WSS/scratch/PulsestormLauncher> tree var
var
├── build
│   └── Pulsestorm_Launcher.tar
└── package

2 directories, 1 file
astorm commented 10 years ago

Ugh, super annoying. Can you send me/upload the actual tar file you're using?

jmshelby commented 10 years ago

it looks like it might be this setting:

'path_output'            => 'var/package',

If it's inside the current directory (or anything relative) it seem to have this problem (maybe tar'ing itself in an endless loop). What really threw me was when I changed the path output to '~/some_other_dir' and it still happened ... it's because the tilde wasn't special for some reason, and it thought that I was specifying the '~/' dir relative from where I was running (same as 'var/package', a relative directory).

Only when I changed the output path to an absolute path (i.e. /Users/jmshelby/...) did the script finally work for me. So I think that's the answer: the path_output config requires an absolute path (or maybe just outside of your project path) and tilde's aren't special for some reason.

So might not be an issue exactly .... but good to know ...

jmshelby commented 10 years ago

Just playing around a little more ... it looks like it's fine to use a directory inside my current project, so long as the 'path_output' value is an absolute path. So just using DIR. '/var/package' works just fine.

astorm commented 10 years ago

THanks for the research -- I'll see if we can get a bug fix in place so this doesn't happen -- or at least the command fails with a warning instead of spinning off forever like that.