Page hangs on save (Save 0%...). However, save is successful

I’m using XWiki 9.5.1 with Tomcat and mySQL on a Windows 2016 server. When saving a page with more than a sentence or two the page hangs at “Save 0%…”. Occasionally I also get “Failed to save the page. Reason: Server not responding” This happens both in the browser on the server or from a remote client. Note however that the page does save and can be accessed as normal once refreshed.

I’ve been playing around with the following settings in server.xml. But haven’t had any luck. Could it be due to Solr indexing? Any help would be appreciated. I can’t find anything useful in the logs.

<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"
URIEncoding="UTF-8"/> 

This is similar to: https://jira.xwiki.org/browse/XWIKI-14046

I had similar issue which I assume was in /etc/nginx/conf.d/tomcat.conf

Refer this if you have similar issue: http://platform.xwiki.org/xwiki/bin/view/AdminGuide/InstallationTomcat#HUsingNginxasareverse-proxyforTomcat28http2Fhttps29

Yep, I don’t think mine is to do with the reverse proxy though as it sits on another server in my configuration. I’m effectively bypassing it when I browse the wiki on the server’s browser, and I still get the problem

Are you using short urls? I remember reading about the same problem due to short urls.

No, normal urls. What’s the best course of action to try and diagnose this. Can I turn anything On or Off to at least narrow down the possible cause?

For me, these were the magical lines which solved my problem instantly. You may at least start by looking for their function in your setup environment.

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;

Vishal,
Unfortunately this didn’t work for me. I think it must be a Tomcat config issue.

I don’t suppose this error has anything to do with the problem?
WARNING [http://cns-sfgi.sgf.org.uk/bin/download/Idgfdas/Ufdgfd.msg] org.apache.catalina.connector.Response.setCharacterEncoding The encoding [] is not recognised by the JRE
java.io.UnsupportedEncodingException: The character encoding [] is not supported

or,
WARNING [http-nio-8080-exec-8] org.apache.catalina.connector.Response.setCharacterEncoding The encoding [] is not recognised by the JRE
java.io.UnsupportedEncodingException: The character encoding [] is not supported

Any help would be appreciated. Out of interest, is there a way to turn off the “Saving…” messages?

OK, so I’ve managed to narrow the symptoms down. It appears to be something to do with the pages created from App Within Minutes. If I take some text and save it with the blank page template, this saves instantly, if I save it through a template created from App Within Minutes it produces the previously described error. Furthermore, I’ve discovered that when I get the error, if I right click on the page and select “inspect element”, the save continues and completes as normal.

Does anyone have a feeling for what this could be? How is the App Within Minutes edit page different to the basic edit page?

Hi Ben,

I’ve never seen this problem nor remember any related issue. What I’d do to try to diagnose the issue is to remove any front end you have in front of your servlet container (ie in front of Tomcat). e.g. nginx. That should allow you to tell if the issue is a config issue of that front end server.

Also you mentioned some encoding errors. Please check this doc for this: http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Encoding

Hope it helps

See https://jira.xwiki.org/browse/XWIKI-14552 in case you added form validation to the application that was created with App Within Minutes.

Hope this helps,
Marius

Marius,
That’s very interesting, even without form validation your fix works for me, i.e. async=false.

To test it I’ve created 4 apps with various fields and layouts. In all of them I get the error unless I create a new page directly from a link such as http://localhost:8080//bin/edit/spaceA/examplePage?template=Example+Templates.template1&parent=spaceA.A&title=examplePageTitle&async=false. Note the &async=false. As suggested by @vmassol I’ve removed everything in front of the servlet.

So, what does this mean? In the event this is a bug, is there a way I can modify the create function so that it always creates the page with &async=false. Would this have any implications?

Apologies if my questions are quite basic, I’m new to all this.

Vincent,
I’ve re-checked all my configuration several times with the encoding article and the SQL article and everything is set correctly. The only setting I haven’t applied is the encoding to the OS as I am on Windows.

Try to look with the browser’s developer tools (Network tab usually) for the save (asynchronous) request and see what’s the response. If the progress remains at 0% then it means the response is not what the JavaScript code expects. Also check if there are any JavaScript exceptions logged in the JavaScript console.

Hope this helps,
Marius

OK, so my browser doesn’t seem to move on to the resubmission after the 302 response. Am I reading this right? Does this mean it is a client side issue?

302 Response:
302

This is where the network trace stops:
stop3333333

Check the body/content of the 302 response. I’m pretty sure it follows the redirect, it just doesn’t show it. But the response body should be from the redirect, i.e. the body should come from /rest/jobstatus/…

There is never anything in the body of the 302, even when saving pages not based on templates, which save without a problem. I have just noticed the charset of the 302 response though, shouldn’t this be UTF-8 like all the other responses?

You might have been on to something when you mentioned JavaScript exceptions. I’ve just tried using Chrome to debug instead and I get the following network abort when navigating to almost every page, where spinner.gif is used by java script for page save status visualisation as far as I can tell.

I’ll run this buy a few colleagues and report back if I get any further.

jquery.js:5799 GET https://cdds-wiki.cfdd.org.uk/bin/resources/icons/xwiki/spinner.gif 404 ()
Fa @ jquery.js:5799
css @ jquery.js:6200
get @ jquery.js:6224
css @ jquery.js:6195
(anonymous) @ jquery.js:9754
K @ jquery.js:3643
n.fn.(anonymous function) @ jquery.js:9727
init @ jstree.min.js:2
a.jstree.create @ jstree.min.js:2
(anonymous) @ jstree.min.js:2
each @ jquery.js:365
each @ jquery.js:137
a.fn.jstree @ jstree.min.js:2
(anonymous) @ tree.min.js:1
each @ jquery.js:365
each @ jquery.js:137
m.fn.xtree @ tree.min.js:1
(anonymous) @ tree.min.js:1
execCb @ require.min.js?r=1:29
check @ require.min.js?r=1:18
(anonymous) @ require.min.js?r=1:22
(anonymous) @ require.min.js?r=1:7
(anonymous) @ require.min.js?r=1:23
y @ require.min.js?r=1:6
emit @ require.min.js?r=1:23
check @ require.min.js?r=1:19
(anonymous) @ require.min.js?r=1:22
(anonymous) @ require.min.js?r=1:7
(anonymous) @ require.min.js?r=1:23
y @ require.min.js?r=1:6
emit @ require.min.js?r=1:23
check @ require.min.js?r=1:19
(anonymous) @ require.min.js?r=1:22
(anonymous) @ require.min.js?r=1:7
(anonymous) @ require.min.js?r=1:23
y @ require.min.js?r=1:6
emit @ require.min.js?r=1:23
check @ require.min.js?r=1:19
enable @ require.min.js?r=1:23
init @ require.min.js?r=1:16
I @ require.min.js?r=1:13
completeLoad @ require.min.js?r=1:28
onScriptLoad @ require.min.js?r=1:29

same problem with creating a page from my template
Xwiki 10.8

I’m having the same problem with with my setup:

WIN Server 2012 R2
IIS 8.5 (acting as a reverse proxy)
PostgreSQL 9.6.11
Jetty 9.4.8.v20171121
XWiki 9.11.8

When creating a new page from a custom template I’m keep getting the same error message: Server not responding.

DevTools tells me, that CORS-Header “Access-Control-Allow-Origin” is missing.

I already turned off IIS and even testet access from the localhost.

Then I tried to help myself by editing the web.xml as follows:

  <filter-mapping>
    <filter-name>Set CORS policy for fonts</filter-name>
    <servlet-name>resourceReferenceHandler</servlet-name>
    <url-pattern>/*</url-pattern>
<!-- changed line above -->
    <url-pattern>*.woff</url-pattern>
    <url-pattern>*.eot</url-pattern>
    <url-pattern>*.ttf</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

This obviously has an effect but did’t solve the problem. It now tells me, that the token ‘x-prototype-version’ is missing.

How can I set that token? CORS settings from Jetty don’t seem to have an effect.

Screenshots:

2018-12-03_16_22_48-Bearbeiten

2018-12-03_16_01_51-Bearbeiten

I see that you have a JavaScript exception in TaskManagerSheet. This might influence the save operation. Are you creating a task (entry) in the Task Manager application? Can you try to create a page based on a different template? Just to make sure that the problem is not caused by this JavaScript exception.

Hey folks.

I’m seeing the same issue so I dug around a little. I think the problem only exists when running behind a reverse proxy or something alike. I’ve never looked at the xwiki source code before today so the following should be taken with a grain of salt. As far as I can see, something like the following happens:

As soon as you hit “Save and View”, the Page is created just as expected. Next, if this is an async request, the server sends a redirect to the job status resource. This is where things go awry. When the client asks for the job status, the server responds with a JSON indicating the state of the job is FINISHED and provides the link to resource. The problem is that the link provided does neither honor xwiki.home, nor does it honor xwiki.url.protocol. I.e, on my machine, http://127.0.0.1:10010/rest/jobstatus/refactoring/create/1546262584501-56 is returned while the URI should be https://xwiki.sabix.de/rest/jobstatus/refactoring/create/1546262584501-561. This is where the SOP kills the request.

I guess the problem is in JobStatusResourceImpl, where uriInfo.getAbsolutePath() is handed down to create the status or in the function called there, which just calls toString() on the supplied URI.

The thing isn’t a big issue for me. I can always just reload the page. Furthermore, I can probably just configure my apache reverse proxy differently. Nevertheless, I think the server should honor the configuration options in any case. Maybe I’m wrong about that.

I’m sorry that I don’t have time to dig around more right now, but if you have any follow up questions, feel free to ask.

1 Like

I am having troubles too setting xwiki up behind nginx with SSL, in a docker environment.
None of all the available guides have worked 100% so far. Until now I was too lazy to create another thread…

Chrome warns in the dev console that the response is HTTP for a HTTPS request, the ressource in question is a animated Progress Indication.gif … i guess i should make another attempt.