Page MenuHomePhabricator

VisualEditor triggers HTTP 500 Parsoid error on Windows because of exception in GlobalIdGenerator
Closed, ResolvedPublic

Description

I am currently running the latest master branch of MediaWiki and is trying to set up VisualEditor for development. However, since Parsoid switch to PHP starting 1.35, a lot of the current instructions become outdated as they are focusing on the Parsoid/JS. I tried the following Parsoid/PHP#Developer_Setup, which results in VisualEditor displaying error HTTP 500 of not being able to connect to Restbase. When visiting the rest.php page, it displays a 404 error, which can be a result of requiring header added by Gerrit patch 552088.

I am confused as T248343 suggests that VE should be working out of the box, meaning no need to set up the RestBase server. Even I want to set up a RestBase server, the current instructor requires me to know the Parsoid/PHP’s server address, which I do not know since Parsoid/PHP becomes an MW instance. As T248319 indicates, there is currently no instruction on how to setup RestBase with Parsoid/PHP.

As someone else on Reddit also indicating the exact same issue and errors for installing 1.35, adding MW-1.35-release.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 5 2020, 10:27 AM
Akuckartz added a subscriber: Akuckartz.
ssastry triaged this task as Medium priority.Aug 5 2020, 9:47 PM
ssastry moved this task from Needs Triage to Non-Wikimedia Parsoid usecases on the Parsoid board.

Don't follow the instructions on the "Developer Setup" wiki page, that's for developers and well, outdated for 1.35. The expectation is that just wfLoadExtension( 'VisualEditor' ); is sufficient. Does that not work for you? You also shouldn't need Restbase AIUI.

cscott added a subscriber: cscott.Aug 5 2020, 11:19 PM

If you use the downloaded tarball for 1.35.0-rc.0, you should be able to just select the checkbox for the 'visual editor' extension, and it 'just works'.

But yes, I need to write/update the docs.

@Legoktm @cscott I have retried with both the latest master branch as well as REL_1.35 branch of MediaWiki core and VisualEditor. I set up MediaWiki by using addshore's mediawiki-docker-dev. I have only put wfLoadExtension( 'VisualEditor' );, and it unfortunately still does not work.

When using VisualEdtor for editing, VisualEditor will still output Error contacting the Parsoid/RESTBase server (HTTP 500).

Just set up MW 1.35.0-rc.0 with the bundled extensions, getting the same error. Also, when switching from Source Editor to Visual Editor, I get the same RESTBase server error first, then get "There is no revision with ID 0." after clicking on "Try Again." The revision error keeps repeating after that. I imagine it's related.

VulpesVulpes825 renamed this task from Setting up VisualEditor following Parsoid/PHP instruction result in HTTP 500 Restbase error to Setting up Zero-configuration VisualEditor in 1.35+ results in HTTP 500 RESTbase error.Aug 7 2020, 2:41 PM
Kghbln added a subscriber: Kghbln.Aug 7 2020, 3:01 PM

To help with debugging and pinpointing the issue, could whoever is running into this issue provide their database engine (note that we already know it doesn't work with SQLite: T259685: Zeroconf VisualEditor/Parsoid doesn't work on SQLite ), and any other extensions they have installed (if you could try with just VE installed that would help too).

If you add $wgDebugLogGroups['http'] = '/var/log/mw-http.log;' (or some other webserver writable path), when opening VE you should see log entries like GET: http://localhost:4881/rest.php/localhost/v3/page/html/Main_Page/6?redirect=false&stash=true`. If you visit that URL in your browser or access it via a tool like curl, does that page work? It should load the page without the skin basically.

And then please explain exactly what steps you take to trigger the error. Does just clicking "edit" result in the HTTP 500 error or is it only when switching from source editor to visual editor?

The HTTP 500 error always triggers when clicking on "Edit", and reappears when clicking on "Try Again". When switching from source to visual editor, the HTTP 500 error always triggers at first, then the error message "There is no revision with ID 0" appears when clicking on "Try Again." I can try the other things.

I could use a step-by-step on the installation process you are using as well. Is this a clean install, or an upgrade? Are you using the web installer or the CLI installer? If using the web installer, exactly what options did you select? What does the end of LocalSettings.php look like when you are done? What platform are you running on, both OS and DB?

OKAY, here goes. It's a clean install, using the web installer.
Setup:

OSWindows Server 2019
ServerIIS 10.0
DBMySQL 8.0.20
PHP7.4.7

This is what the last part of LocalSettings.php looks like right now:

# Enabled extensions. Most of the extensions are enabled by adding
# wfLoadExtension( 'ExtensionName' );
# to LocalSettings.php. Check specific extension documentation for more details.
# The following extensions were automatically enabled:
// wfLoadExtension( 'Cite' );
// wfLoadExtension( 'CiteThisPage' );
// wfLoadExtension( 'CodeEditor' );
// wfLoadExtension( 'ConfirmEdit' );
// wfLoadExtension( 'Gadgets' );
// wfLoadExtension( 'InputBox' );
// wfLoadExtension( 'Interwiki' );
// wfLoadExtension( 'MultimediaViewer' );
// wfLoadExtension( 'Nuke' );
// wfLoadExtension( 'OATHAuth' );
// wfLoadExtension( 'PageImages' );
// wfLoadExtension( 'ParserFunctions' );
// wfLoadExtension( 'Renameuser' );
// wfLoadExtension( 'ReplaceText' );
// wfLoadExtension( 'SecureLinkFixer' );
// wfLoadExtension( 'TemplateData' );
// wfLoadExtension( 'TextExtracts' );
wfLoadExtension( 'VisualEditor' );
// wfLoadExtension( 'WikiEditor' );


# End of automatically generated settings.
# Add more configuration options below.

$wgDebugLogGroups['http'] = 'mw-http.log';

Which options are you asking about specifically in the web installer? I think I just went through it pretty normally. Not gonna lie, this was the smoothest setup I've had so far, barring the VE issues.

I've disabled all the extensions I enabled, as you can see, but that didn't make a difference, still getting the same errors. I added the $wgDebugLogGroups['http'] = 'mw-http.log';. When clicking on "Edit", I get a URL in the log file, but the url returns a Runtime Exception. Enabling the debugging lines, getting this:

[8905c82407b1566292880c64] /rest.php/avengersdatabase.com/v3/page/html/Main_Page/1?redirect=false&stash=true RuntimeException from line 448 of C:\inetpub\avengersdatabase\wwwroot\includes\libs\uuid\GlobalIdGenerator.php: Could not open 'C:\windows\TEMP/mw-Wikimedia\UUID\GlobalIdGenerator-UUID-128'.

Backtrace:

#0 C:\inetpub\avengersdatabase\wwwroot\includes\libs\uuid\GlobalIdGenerator.php(204): Wikimedia\UUID\GlobalIdGenerator->getTimeAndDelay()
#1 C:\inetpub\avengersdatabase\wwwroot\includes\utils\UIDGenerator.php(88): Wikimedia\UUID\GlobalIdGenerator->newUUIDv1()
#2 C:\inetpub\avengersdatabase\wwwroot\extensions\VisualEditor\includes\VEParsoid\src\Rest\Handler\ParsoidHandler.php(564): UIDGenerator::newUUIDv1()
#3 C:\inetpub\avengersdatabase\wwwroot\extensions\VisualEditor\includes\VEParsoid\src\Rest\Handler\PageHandler.php(110): VEParsoid\Rest\Handler\ParsoidHandler->wt2html()
#4 C:\inetpub\avengersdatabase\wwwroot\includes\Rest\Router.php(365): VEParsoid\Rest\Handler\PageHandler->execute()
#5 C:\inetpub\avengersdatabase\wwwroot\includes\Rest\Router.php(320): MediaWiki\Rest\Router->executeHandler()
#6 C:\inetpub\avengersdatabase\wwwroot\includes\Rest\EntryPoint.php(133): MediaWiki\Rest\Router->execute()
#7 C:\inetpub\avengersdatabase\wwwroot\includes\Rest\EntryPoint.php(100): MediaWiki\Rest\EntryPoint->execute()
#8 C:\inetpub\avengersdatabase\wwwroot\rest.php(31): MediaWiki\Rest\EntryPoint::main()
#9 {main}

Also seeing this at the top of the page, it seems to be breaking the <head></head> elements:

Warning: fopen(C:\windows\TEMP/mw-Wikimedia\UUID\GlobalIdGenerator-UUID-128): failed to open stream: No such file or directory in C:\inetpub\avengersdatabase\wwwroot\includes\libs\uuid\GlobalIdGenerator.php on line 443

Lacking any documentation for how to set up VisualEditor/Parsoid/PHP, and me being a non-expert at any of this, it's totally plausible that I'm missing something in the setup, but I couldn't figure out what.

Change 619073 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/core@master] uuid: Fix filenames on Windows

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

[8905c82407b1566292880c64] /rest.php/avengersdatabase.com/v3/page/html/Main_Page/1?redirect=false&stash=true RuntimeException from line 448 of C:\inetpub\avengersdatabase\wwwroot\includes\libs\uuid\GlobalIdGenerator.php: Could not open 'C:\windows\TEMP/mw-Wikimedia\UUID\GlobalIdGenerator-UUID-128'.

Backtrace:

#0 C:\inetpub\avengersdatabase\wwwroot\includes\libs\uuid\GlobalIdGenerator.php(204): Wikimedia\UUID\GlobalIdGenerator->getTimeAndDelay()
#1 C:\inetpub\avengersdatabase\wwwroot\includes\utils\UIDGenerator.php(88): Wikimedia\UUID\GlobalIdGenerator->newUUIDv1()
#2 C:\inetpub\avengersdatabase\wwwroot\extensions\VisualEditor\includes\VEParsoid\src\Rest\Handler\ParsoidHandler.php(564): UIDGenerator::newUUIDv1()
#3 C:\inetpub\avengersdatabase\wwwroot\extensions\VisualEditor\includes\VEParsoid\src\Rest\Handler\PageHandler.php(110): VEParsoid\Rest\Handler\ParsoidHandler->wt2html()
#4 C:\inetpub\avengersdatabase\wwwroot\includes\Rest\Router.php(365): VEParsoid\Rest\Handler\PageHandler->execute()
#5 C:\inetpub\avengersdatabase\wwwroot\includes\Rest\Router.php(320): MediaWiki\Rest\Router->executeHandler()
#6 C:\inetpub\avengersdatabase\wwwroot\includes\Rest\EntryPoint.php(133): MediaWiki\Rest\Router->execute()
#7 C:\inetpub\avengersdatabase\wwwroot\includes\Rest\EntryPoint.php(100): MediaWiki\Rest\EntryPoint->execute()
#8 C:\inetpub\avengersdatabase\wwwroot\rest.php(31): MediaWiki\Rest\EntryPoint::main()
#9 {main}

Also seeing this at the top of the page, it seems to be breaking the <head></head> elements:

Warning: fopen(C:\windows\TEMP/mw-Wikimedia\UUID\GlobalIdGenerator-UUID-128): failed to open stream: No such file or directory in C:\inetpub\avengersdatabase\wwwroot\includes\libs\uuid\GlobalIdGenerator.php on line 443

Thank you for your patience in debugging with us - this exception seems to be the key. Can you try applying the above Gerrit patch I just posted and see if that fixes it for you?

That did it! Visual Editor is loading normally from "Edit" and I can switch to it from the source editor, too, without any issues!

Legoktm renamed this task from Setting up Zero-configuration VisualEditor in 1.35+ results in HTTP 500 RESTbase error to VisualEditor triggers HTTP 500 RESTbase error on Windows because of exception in GlobalIdGenerator.Aug 7 2020, 11:56 PM
Legoktm claimed this task.

That did it! Visual Editor is loading normally from "Edit" and I can switch to it from the source editor, too, without any issues!

Perfect!

@VulpesVulpes825 just to confirm, are you also on Windows?

Legoktm renamed this task from VisualEditor triggers HTTP 500 RESTbase error on Windows because of exception in GlobalIdGenerator to VisualEditor triggers HTTP 500 Parsoid error on Windows because of exception in GlobalIdGenerator.Aug 8 2020, 12:47 AM

Change 619053 had a related patch set uploaded (by C. Scott Ananian; owner: Legoktm):
[mediawiki/core@REL1_35] uuid: Fix filenames on Windows

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

Change 619073 merged by jenkins-bot:
[mediawiki/core@master] uuid: Fix filenames on Windows

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

@Legoktm I am on Linux using addshore's mediawiki-docker-dev. I used a clean installation with CLI.

OSUbuntu 18.04.4 LTS
MediaWiki1.35.0-rc.0 (c1ac169)
PHP7.2.24-0ubuntu0.18.04.3 (fpm-fcgi)
MariaDB10.5.4-MariaDB-1:10.5.4+maria~focal-log

When visiting the rest.php, I got

127.0.0.1 -  08/Aug/2020:02:36:18 +0000 "GET /rest.php?redirect=false&stash=true" 404 - cpu:0.00% mem:2 reqTime:0.003
[Sat Aug 08 02:36:18.931889 2020] [proxy_fcgi:error] [pid 112:tid 140709873039104] [client 172.0.0.2:54176] AH01071: Got error 'Primary script unknown\n'
docker.vm:80 172.0.0.2 - - [08/Aug/2020:02:36:18 +0000] "GET /rest.php/default.web.mw.localhost/v3/page/html/Main_Page/6?redirect=false&stash=true HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"

When using VisualEditor for editing, I got

[Sat Aug 08 02:36:18.931889 2020] [proxy_fcgi:error] [pid 112:tid 140709873039104] [client 172.0.0.2:54176] AH01071: Got error 'Primary script unknown\n'
docker.vm:80 172.0.0.2 - - [08/Aug/2020:02:36:18 +0000] "GET /rest.php/default.web.mw.localhost/v3/page/html/Main_Page/6?redirect=false&stash=true HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"
[httpd:access] default.web.mw.localhost:80 172.0.0.1 - 172.0.0.2 - - [08/Aug/2020:02:36:18 +0000] "GET /rest.php/default.web.mw.localhost/v3/page/html/Main_Page/6?redirect=false&stash=true HTTP/1.1" 404 bytesIn:808 bytesOut:209 reqTime:0
[SYSLOG] CRON[414]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
[Sat Aug 08 02:39:21.879450 2020] [proxy_fcgi:error] [pid 112:tid 140709856253696] [client 172.0.0.2:54226] AH01071: Got error 'Primary script unknown\n'
127.0.0.1 -  08/Aug/2020:02:39:21 +0000 "GET /rest.php?redirect=false&stash=true" 404 - cpu:1219.51% mem:2 reqTime:0.001
docker.vm:80 172.0.0.2 - - [08/Aug/2020:02:39:21 +0000] "GET /rest.php/localhost/v3/page/html/Main_Page/6?redirect=false&stash=true HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"
[httpd:access] default.web.mw.localhost:80 172.0.0.1 - 172.0.0.2 - - [08/Aug/2020:02:39:21 +0000] "GET /rest.php/localhost/v3/page/html/Main_Page/6?redirect=false&stash=true HTTP/1.1" 404 bytesIn:813 bytesOut:209 reqTime:0
127.0.0.1 -  08/Aug/2020:02:41:08 +0000 "GET /rest.php?redirect=false&stash=true" 404 - cpu:0.00% mem:2 reqTime:0.000
docker.vm:80 172.0.0.2 - - [08/Aug/2020:02:41:08 +0000] "GET /rest.php/default.web.mw.localhost/v3/page/html/Main_Page/6?redirect=false&stash=true HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"
[httpd:access] default.web.mw.localhost:80 172.0.0.1 - 172.0.0.2 - - [08/Aug/2020:02:41:08 +0000] "GET /rest.php/default.web.mw.localhost/v3/page/html/Main_Page/6?redirect=false&stash=true HTTP/1.1" 404 bytesIn:854 bytesOut:209 reqTime:0
[Sat Aug 08 02:41:08.126505 2020] [proxy_fcgi:error] [pid 112:tid 140710000236288] [client 172.0.0.2:54264] AH01071: Got error 'Primary script unknown\n'
docker.vm:80 172.0.0.2 - - [08/Aug/2020:02:42:05 +0000] "GET /mediawiki/index.php?title=%E9%A6%96%E9%A1%B5 HTTP/1.1" 404 14147 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"
127.0.0.1 -  08/Aug/2020:02:42:42 +0000 "GET /mediawiki/rest.php?redirect=false&stash=true" 500 /var/www/mediawiki/rest.php cpu:29.48% mem:20 reqTime:7.259
docker.vm:80 172.0.0.2 - - [08/Aug/2020:02:42:42 +0000] "GET /mediawiki/rest.php/default.web.mw.localhost/v3/page/html/Main_Page/1?redirect=false&stash=true HTTP/1.1" 500 16636 "-" "VisualEditor-MediaWiki/1.35.0-rc.0"
[httpd:access] default.web.mw.localhost:80 172.0.0.9 - 172.0.0.2 - - [08/Aug/2020:02:42:42 +0000] "GET /mediawiki/rest.php/default.web.mw.localhost/v3/page/html/Main_Page/1?redirect=false&stash=true HTTP/1.1" 500 bytesIn:517 bytesOut:16636 reqTime:7
docker.vm:80 172.0.0.2 - - [08/Aug/2020:02:42:38 +0000] "GET /mediawiki/api.php?action=visualeditor&format=json&paction=parse&page=Main_Page&uselang=en&formatversion=2 HTTP/1.1" 200 1027 "http://default.web.mw.localhost:8080/mediawiki/index.php?title=Main_Page&veaction=edit" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"
[httpd:access] default.web.mw.localhost:80 172.0.0.1 - 172.0.0.2 - - [08/Aug/2020:02:42:38 +0000] "GET /mediawiki/api.php?action=visualeditor&format=json&paction=parse&page=Main_Page&uselang=en&formatversion=2 HTTP/1.1" 200 bytesIn:852 bytesOut:1027 reqTime:12

It is a Primary script unknown issue, but the application in docker should have granted root access as it is running in docker.

docker.vm:80 172.0.0.2 - - [08/Aug/2020:02:42:42 +0000] "GET /mediawiki/rest.php/default.web.mw.localhost/v3/page/html/Main_Page/1?redirect=false&stash=true HTTP/1.1" 500 16636 "-" "VisualEditor-MediaWiki/1.35.0-rc.0"
[httpd:access] default.web.mw.localhost:80 172.0.0.9 - 172.0.0.2 - - [08/Aug/2020:02:42:42 +0000] "GET /mediawiki/rest.php/default.web.mw.localhost/v3/page/html/Main_Page/1?redirect=false&stash=true HTTP/1.1" 500 bytesIn:517 bytesOut:16636 reqTime:7

So that's the HTTP 500. Can you enable the settings from https://www.mediawiki.org/wiki/Manual:How_to_debug and and provide a stacktrace?

Change 619053 merged by jenkins-bot:
[mediawiki/core@REL1_35] uuid: Fix filenames on Windows

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

Kghbln removed a subscriber: Kghbln.Aug 8 2020, 9:50 AM
Kghbln added a subscriber: Kghbln.
Majavah added a subscriber: Majavah.Aug 9 2020, 2:17 PM
cscott closed this task as Resolved.Aug 9 2020, 6:33 PM

@VulpesVulpes825, @Legoktm I've forked the mediawiki-docker-dev issue into T260002: Bundled Parsoid for VisualEditor doesn't work in mediawiki-docker-dev since it seems to be different from the bug reported by @KeybladeSpyMaster which @Legoktm appears to have fixed with his patch. Yes, I know, really I should have forked @KeybladeSpyMaster's bug into a different number and left this one for @VulpesVulpes825, but the patch for the windows filename bug has already landed with this bug id in it.

Please follow up in T260002: Bundled Parsoid for VisualEditor doesn't work in mediawiki-docker-dev with the stacktrace @Legoktm requested, if you can.

Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptAug 9 2020, 6:33 PM