Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Just fight with suddenly broken drush
$ drush status
Drush command could not be completed. [error]
And found, that, if I disable MultiLink Redirect -
$ drush status
Drupal version : 6.17
Site URI : http://default
Database driver : mysqli
Database hostname : localhost
Database username : example_drupal
Database name : www_example
Database : Connected
Drupal bootstrap : Successful
Drupal user : Anonymous
Default theme : example
Administration theme : pushbutton
PHP configuration : /etc/php5/cli/php.ini
Drush version : 4.0-dev
Drush configuration :
Drupal root : /home/vaulter/www/example.localhost
Site path : sites/default
File directory path : sites/default/files
Comments
Comment #1
Andy Inman CreditAttribution: Andy Inman commentedI regret I have no experience with Drush. Presumably it is trying to use some url which was getting redirected (rightly or wrongly). Was there anything in the Drupal log? Could it be an out of memory problem for example? If you take a look at the multilink redirect module, you'll see it's fairly simple - perhaps you could try to find a solution?
Comment #2
Simon Georges CreditAttribution: Simon Georges commentedI've just reproduced the bug. Activating Multilink_redirect generate this output for drush :
I'm guessing this has something to do with the
hook_init()
... The only documentation I manged to find mentionned thatnode_load()
should not be called fromhook_init()
. And I see that_multilink_getnode()
callsmultilink_buildnode()
that performsnode_load()
.I hope it helps...
Regards,
Comment #3
Andy Inman CreditAttribution: Andy Inman commentedHi, thanks for that info, very useful. I've not had a chance to look at this yet, Could you give me a link to the docs you refer to? http://api.drupal.org/api/function/hook_init/6 does not mention any restriction on calling node_load() and implies - when this hook is called, all modules are already loaded in memory - that internal Drupal and add-on module functions should be available.
If node_load() is indeed the problem, then it would only happen for non-cached links - I'm referring to multilink's internal caching - see _multilink_getnode() - node_load would not get called if the result were already cached. Try simply commenting-out the node_load (line 316 in multilink.module) - does that make the problem go away? (if you do this, invalid cache entries will be created, so clear multilink's cache table afterwards.)
If we can confirm that node_load is what triggers the problem, then it should be fairly easy to replace node_load with a database query or other function call. An alternative might be to disable redirection when running under Drush - redirection is intended to help users arrive at the correct page, it's probably not needed when running Drush scripts?
Comment #4
Andy Inman CreditAttribution: Andy Inman commentedDon't know if its any help, but the latest version allows the redirection to by bypassed based on permission/role - do Drush scripts effectively run as uid==1 ? If so then it might work now, or if Drush runs as some other user id, then it should be possible to achieve the same.
Comment #5
Andy Inman CreditAttribution: Andy Inman commentedPlease confirm whether #4 provides a solution. I am supposing that it does and so marking this as "fixed".
Comment #7
sumpfralle CreditAttribution: sumpfralle commentedThe bug seems to persist with 6.x-2.4 :(
multilink disabled: drush works fine
multilink enabled: drush fails
I am using drush 4.4. The same happens with v3.3.
$ drush -d status
Bootstrap to phase 0. [0.02 sec, 2.2 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.02 sec, 2.43 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.05 sec, 5.83 MB] [bootstrap]
Initialized Drupal 6.19 root directory at /data/drupal [0.06 sec, 6.72 MB] [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.06 sec, 6.73 MB] [bootstrap]
Initialized Drupal site fab.senselab.org at sites/fab.senselab.org [0.06 sec, 6.73 MB] [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.07 sec, 6.74 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.07 sec, 6.78 MB] [bootstrap]
Successfully connected to the Drupal database. [0.07 sec, 6.78 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.07 sec, 7.16 MB] [bootstrap]
Drush command terminated abnormally due to an unrecoverable error. [0.25 sec, 26.99 MB]
do you have any idea how I could debug this issue?
cheers,
Lars
Comment #8
Andy Inman CreditAttribution: Andy Inman commentedI hit this problem myself and confirmed if you disable the Redirection module, then drush works. I guess there must be some easy way to detect that Drupal is being run under drush, and disable redirection - any ideas?
I'll take a closer look at this when I get the chance.
Comment #9
dmatamales CreditAttribution: dmatamales commentedsubscribing
Comment #10
Andy Inman CreditAttribution: Andy Inman commentedThis problem seems to have gone away - could anyone else confirm? I haven't changed MultiLink specifically to address this issue, so assume that drush or something else has changed. Testing with Drupal 6.22, Drush 4.4, MultiLink 2.5. drush status and other drush commands seem to work fine.
Comment #11
david.gil CreditAttribution: david.gil commentedWith Drupal 7.9, Drush 4.5 it still gives the same error.
Comment #12
Andy Inman CreditAttribution: Andy Inman commentedThanks for the report David. Are you using the MultiLink "Redirect Cached" module or just the Redirect?
I've opened a new issue against the D7 version here: http://drupal.org/node/1365882
Comment #13
sumpfralle CreditAttribution: sumpfralle commentedI experienced the same issue: enabling "multilink redirect" causes drush to break. The "redirect cached" module is not in use. Disabling the multilink redirect module immediately fixes the problem ("drush status" works again). I use Drush 4.4.
I posted the list of all installed modules here: http://pastebin.com/TZ4DQyrb
Comment #14
Andy Inman CreditAttribution: Andy Inman commentedIt's working fine for me with Drupal 6.22 and Drush 5.4. Any chance you could try that version?
Comment #15
Andy Inman CreditAttribution: Andy Inman commentedAh, I just remembered that I did add a specific check in the 7.x branch:
That would need to go into lines 82/83 of multilink_redirect.module where we currently have:
So, it looks like this does need to be implemented in the 6.x branch, though I don't why it only fails with some configurations and not others.
Comment #16
truyenle CreditAttribution: truyenle commentedConfirm it, break my Drush also. Drupal 6.26
Comment #17
Andy Inman CreditAttribution: Andy Inman commentedtruyenle, please see the solution in #15. That's needed at line 82/83 of multilink_redirect.module.
I need to released an update with this fix included.
Comment #18
Andy Inman CreditAttribution: Andy Inman commentedNow fixed in release 2.8.