Topic on Project:Support desk

Wrong behaviour when a section is edited

18
NikusPokus (talkcontribs)

When a section is edited, the following wrong behaviours happen:

  • Wrong text is displayed (html or markdown text from mediawiki files)
  • Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2708295328 bytes) in /usr/share/webapps/mediawiki/includes/editpage/TextboxBuilder.php on line 49
  • 502 Bad Gateway
  • Blank page

This only happen when a section is edited. When the whole page is edited everything works well.

  • MW version 1.32.3
  • nginx 1.16.0 - uwsgi 2.0.18 - php 7.3.7
MarkAHershberger (talkcontribs)
NikusPokus (talkcontribs)

Whatever the amount of memory I allow, I still have the problem. It looks like a memory leak. I am looking for a solution to fix the cause not the consequences.

MarkAHershberger (talkcontribs)

You did not say that you had already tried increasing the memory.

Next thing to try is some debugging lines:

error_reporting( -1 );
ini_set( 'display_errors', 1 );
$wgDebugDumpSql = true;

And you've given us very little information. Can you point to the wiki so we can see this behavior in action?

If you can't share your wiki, it would be good to know what sort of content is on the wiki and how big the pages are and how big your sections are.

NikusPokus (talkcontribs)

Thanks for your comment. All the sections have the problem whereas the modification of all the pages works well, so it doesn't seem to be a problem with the size of the content.

Here are the errors I have:

Mediawiki

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2710392480 bytes) in /usr/share/webapps/mediawiki/includes/editpage/TextboxBuilder.php on line 49

Nginx

2019/07/24 23:45:32 [error] 3337#3337: *9 upstream prematurely closed connection while reading response header from upstream, request: "GET /index.php?title=Test&action=edit&section=1 HTTP/2.0", upstream: "uwsgi://unix:/run/uwsgi/mediawiki.sock:"

Uwsgi

[pid: 3345|app: -1|req: -1/10151] 192.168.0.1 () {48 vars in 927 bytes} [Thu Jul 25 00:31:56 2019] GET /wiki/Test => generated 7152 bytes in 190 msecs (HTTP/2.0 200) 9 headers in 330 bytes (0 switches on core 0) !!! uWSGI process 3451 got Segmentation Fault !!!

      • backtrace of 3451 ***
      • end of backtrace ***

DAMN ! worker 1 (pid: 3451) died :( trying respawn ... Respawned uWSGI worker 1 (new pid: 3517)

MySql

jui 25 00:39:31 odroid mysqld[430]: 2019-07-25 0:39:31 81886 [Warning] Aborted connection 81886 host: 'localhost' (Got an error reading communication packets)

MarkAHershberger (talkcontribs)

Can I ask why you're using uwsgi? It looks like that is the core of your problem. Maybe switch to php's fpm?

NikusPokus (talkcontribs)

I switched to php-fpm but I still have the problem:

[error] 13891#13891: *34 recv() failed (104: Connection reset by peer) while reading response header from upstream, request: "GET /index.php?title=Test&action=edit&section=1 HTTP/2.0", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:"

php-fpm[317]: [WARNING] [pool www] child 332 exited on signal 11 (SIGSEGV) after 54261.339575 seconds from start

php-fpm[317]: [NOTICE] [pool www] child 13945 started

MarkAHershberger (talkcontribs)

I take it the "54261.339575 seconds" is not the actual time? That would mean it had been running for 15 hours.

And, if it had been running for 15 hours, that sounds pretty good.

But segfaults are not good.

Since this is only happening when a section of the page is being ediited, have you tried using the debug log to see if it happens in the same place every time?

NikusPokus (talkcontribs)

In my opinion, the query which fetch the data from edit section retrieve the wrong data. Sometime the content is too long and cause a "String size overflow". I don't know where to look to find the source of the problem.

Here is the debug log when the edit section doesn't crash but display the wrong data:

MarkAHershberger (talkcontribs)

What do you mean by "wrong data"? Is it just gibberish or the wrong section or what?

NikusPokus (talkcontribs)

Depending on the section I try to edit I have the following data displayed:

bitcoin\:|ftp\:\/\/|ftps\:\/\/|geo\:|git\:\/\/|gopher\:\/\/|http\:\/\/|https\:\/\/|irc\:\/\/|ircs\:\/\/|magnet\:|mailto\:|mms\:\/\/|news\:|nntp\:\/\/|redis\:\/\/|sftp\:\/\/|sip\:|sips\:|sms\:|ssh\:\/\/|svn\:\/\/|tel\:|telnet\:\/\/|urn\:|worldwind\:\/\/|xmpp\:
/(?P<a_newsectionlink>__LIENNOUVELLESECTION__)|(?P<b_newsectionlink>)|(?P<a_nonewsectionlink>__AUCUNLIENNOUVELLESECTION__)|(?P<b_nonewsectionlink>)|(?P<a_hiddencat>__CATCACHEE__)|(?P<b_hiddencat>)|(?P<a_index>)|(?P<a_noindex>__AUCUNINDEX__)|(?P<b_noindex>)|(?P<a_staticredirect>__REDIRECTIONSTATIQUE__)|(?P<b_staticredirect>)/S
<div id="wikiPreview" class="ontop" style="display: none;"><div lang="fr" dir="ltr" class="mw-content-ltr"></div></div><form class="mw-editform" id="editform" name="editform" method="post" action="/index.php?title=UberGallery&amp;action=submit" enctype="multipart/form-data"><input type="hidden" value="ℳ𝒲♥𝓊𝓃𝒾𝒸ℴ𝒹ℯ" name="wpUnicodeCheck"/><div id="antispam-container" style="display: none;"><label for="wpAntispam">Vérification anti-pourriel.
Ne <strong>rien</strong> inscrire ici !</label><input type="text" name="wpAntispam" id="wpAntispam" value="" /></div><input type="hidden" name="editingStatsId" id="editingStatsId" value="501bac7d561b918b10eb23ace56e6aa4" /><input type="hidden" value="4" name="wpSection"/><input type="hidden" value="20190728205632" name="wpStarttime"/><input type="hidden" value="20140112230032" name="wpEdittime"/>
MarkAHershberger (talkcontribs)

And, I take it that this information isn't on the page anywhere?

NikusPokus (talkcontribs)

You are right, this information isn't on the page anywhere but it is on some other mediawiki system pages.

MarkAHershberger (talkcontribs)

I really don't understand your problem, but the first place I would begin to look now is to see if your system is running out of memory.

Bawolff (talkcontribs)

If PHP is segfaulting, perhaps there is also data corruption, which is what is causing random strings to be displayed on page that shouldn't be.

I suppose try installing a different version of php and see if it goes away (I guess. Not really sure what else to suggest. Maybe a PHP specific form would be able to help you debug the segfault)

NikusPokus (talkcontribs)

The problem seems fixed with the update 1.33. Thanks for your help.

Bawolff (talkcontribs)

Also, maybe try disabling all extensions to rule out that it is an extension causing the problem.

NikusPokus (talkcontribs)

@Bawolff, thanks for your comment. I commented all the extensions but I still have the problem.

Reply to "Wrong behaviour when a section is edited"