Page MenuHomePhabricator

"Unable to determine IP" error in phpsh
Closed, ResolvedPublic

Description

I haven't determined where the underlying issue is yet, but starting phpsh gives an internal error, "Unable to determine IP":


<html><head><title>Internal error - devwiki</title><style>body { font-family: sans-serif; margin: 0; padding: 0.5em 2em; }</style></head><body>
<p>[7b2701b4] /usr/local/lib/python2.7/dist-packages/phpsh/phpsh.php Exception from line 1123 of /vagrant/mediawiki/includes/WebRequest.php: Unable to determine IP.</p><p>Backtrace:</p><p>#0 /vagrant/mediawiki/includes/User.php(1934): WebRequest-&gt;getIP()<br />
#1 /vagrant/mediawiki/includes/db/Database.php(1024): User-&gt;getName()<br />
#2 /vagrant/mediawiki/includes/db/Database.php(1601): DatabaseBase-&gt;query(string, string)<br />
#3 [internal function]: DatabaseBase-&gt;select(string, string, array, string)<br />
#4 /vagrant/mediawiki/includes/db/LoadBalancer.php(1180): call_user_func_array(array, array)<br />
#5 /vagrant/mediawiki/includes/jobqueue/JobQueueDB.php(617): DBConnRef-&gt;__call(string, array)<br />
#6 /vagrant/mediawiki/includes/jobqueue/JobQueueDB.php(617): DBConnRef-&gt;select(string, string, array, string)<br />
#7 /vagrant/mediawiki/includes/jobqueue/JobQueue.php(666): JobQueueDB-&gt;doGetSiblingQueuesWithJobs(array)<br />
#8 /vagrant/mediawiki/includes/jobqueue/JobQueueGroup.php(284): JobQueue-&gt;getSiblingQueuesWithJobs(array)<br />
#9 /vagrant/mediawiki/includes/jobqueue/JobQueueGroup.php(265): JobQueueGroup-&gt;getQueuesWithJobs()<br />
#10 /vagrant/mediawiki/includes/Wiki.php(670): JobQueueGroup-&gt;queuesHaveJobs(integer)<br />
#11 /vagrant/mediawiki/includes/Wiki.php(463): MediaWiki-&gt;triggerJobs()<br />
#12 /vagrant/mediawiki/index.php(46): MediaWiki-&gt;run()<br />
#13 /etc/phpsh/rc.php(15): include_once(string)<br />
#14 /usr/local/lib/python2.7/dist-packages/phpsh/phpsh.php(60): require_once(string)<br />
#15 {main}</p>
</body></html>


Since it's database-related, I tried update.php, but that didn't fix it.


Version: unspecified
Severity: normal

Details

Reference
bz66588

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:26 AM
bzimport set Reference to bz66588.

Looks to be caused by I9541afa408d895c3fd337a883ecfe4ce0ba57090.

Hack workaround is to run REMOTE_ADDR=127.0.0.1 phpsh so that WebRequest::getRawIP() will return an non-null value.

  • Bug 67009 has been marked as a duplicate of this bug. ***

Change 155174 had a related patch set uploaded by BryanDavis:
Set _SERVER['REMOTE_ADDR'] in cli mode

https://gerrit.wikimedia.org/r/155174

Change 155174 merged by jenkins-bot:
Set _SERVER['REMOTE_ADDR'] in cli mode

https://gerrit.wikimedia.org/r/155174

This fix was reverted in I288974f6cb8899862eccd6dba5a37adba101855e. Hopefully most people are using hhvm and not phpsh now.

Somehow phpsh is still working for me (when zend role is enabled), albeit with:


subprocess died with return code: 0

PHP died. Restarting php

Not sure the cause of that bug.

In T68588#714414, @Mattflaschen wrote:

Somehow phpsh is still working for me (when zend role is enabled),

I get this failure unless I use bd808's "hack workaround" REMOTE_ADDR=127.0.0.1 phpsh.

albeit with:


subprocess died with return code: 0

PHP died. Restarting php

I get that too. I tried running as root with sudo MW_INSTALL_PATH=/home/spage/projects/core REMOTE_ADDR=127.0.0.1 phpsh , it didn't help.