Project

General

Profile

Actions

Bug #1488

closed

WFileUpload error

Added by Mamadou Babaei over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
10/19/2012
Due date:
% Done:

0%

Estimated time:

Description

Hi,

I used WFileUpload with older releases of Wt (eg. 3.0.x and 3.1.x) and it was working perfectly. But now I tried 3.2.1, 3.2.3-rc1 and the git version and they are all having a strange problem.

I have 20480 in my wt_config.xml,

and client_max_body_size 100M; in nginx.conf.

When I upload a file less than 128K I got this log from my app:

[2012-Oct-19 19:51:51.421025] 79533 [/samsungdforum.ir/www/root.fcgi 90qdmmUlMZCguQq0] [info] "WebRequest: took 0.903ms"

[2012-Oct-19 19:51:51.526696] 79533 - [info] "CgiParser: end of multi-part data"

[2012-Oct-19 19:51:51.526976] 79533 [/samsungdforum.ir/www/root.fcgi 90qdmmUlMZCguQq0] [info] "WebRequest: took 101.07ms"

[2012-Oct-19 19:51:51.554017] 79532 - [error] "wtfcgi: error reading from web server"

[2012-Oct-19 19:51:51.607976] 79533 [/samsungdforum.ir/www/root.fcgi 90qdmmUlMZCguQq0] [info] "WebRequest: took 182.625ms"

[2012-Oct-19 19:51:51.610419] 79533 [/samsungdforum.ir/www/root.fcgi 90qdmmUlMZCguQq0] [info] "WebRequest: took 2.685ms"

I have access to the file on server side and the file content is just fine (even thought there is an error in the log).

When I upload a file larger than 128K my app prints out the file content to the log output, and then an error like the above one and uploaded() is not emitted (looks like it got canceled).

[FILE CONTENT HERE]

[2012-Oct-19 19:52:38.975738] 79532 - [error] "wtfcgi: error reading from web server"

[2012-Oct-19 19:52:39.030842] 79533 [/samsungdforum.ir/www/root.fcgi 90qdmmUlMZCguQq0] [info] "WebRequest: took 489.009ms"

[2012-Oct-19 19:52:39.031380] 79533 [/samsungdforum.ir/www/root.fcgi 90qdmmUlMZCguQq0] [info] "WebRequest: took 0.76ms"

If the file is larger, lets say 4-5 MB:

Chromium:

[FILE CONTENT HERE]

---------WebKitFormBoundarytqO5yLPQ8816uuNb---

[2012-Oct-19 20:13:51.471277] 79533 [/samsungdforum.ir/www/root.fcgi HMTDm7gwC0kwVmIP] [info] "WebRequest: took 15760.1ms"

[2012-Oct-19 20:13:51.491825] 79532 - [error] "wtfcgi: error reading from web server"

[2012-Oct-19 20:13:51.547097] 79533 [/samsungdforum.ir/www/root.fcgi HMTDm7gwC0kwVmIP] [info] "WebRequest: took 16389.9ms"

[2012-Oct-19 20:13:51.547403] 79533 [/samsungdforum.ir/www/root.fcgi HMTDm7gwC0kwVmIP] [info] "WebRequest: took 0.462ms"

Firefox:

[FILE CONTENT HERE]

--------------------------------------------17205573312277156691194368507---

[2012-Oct-19 20:15:40.261953] 79533 [/samsungdforum.ir/www/root.fcgi 8XaFLlZWowafm9sG] [info] "WebRequest: took 14774.4ms"

[2012-Oct-19 20:15:40.275596] 79532 - [error] "wtfcgi: error reading from web server"

[2012-Oct-19 20:15:40.327589] 79533 [/samsungdforum.ir/www/root.fcgi 8XaFLlZWowafm9sG] [info] "WebRequest: took 15502.1ms"

[2012-Oct-19 20:15:40.327880] 79533 [/samsungdforum.ir/www/root.fcgi 8XaFLlZWowafm9sG] [info] "WebRequest: took 0.448ms"

[2012-Oct-19 20:16:25.394954] 79533 [/samsungdforum.ir/www/root.fcgi HMTDm7gwC0kwVmIP] [info] "WebRequest: took 0.328ms"

Opera:

[FILE CONTENT HERE]

------------------gu1vR4rOoeI4eo0Gp4Au6G---

[2012-Oct-19 20:18:03.907876] 79533 [/samsungdforum.ir/www/root.fcgi Roqxc78252SgtTvp] [info] "WebRequest: took 14937.1ms"

[2012-Oct-19 20:18:03.968162] 79532 - [error] "wtfcgi: error reading from web server"

[2012-Oct-19 20:18:04.048842] 79533 [/samsungdforum.ir/www/root.fcgi Roqxc78252SgtTvp] [info] "WebRequest: took 15471.7ms"

[2012-Oct-19 20:18:04.049153] 79533 [/samsungdforum.ir/www/root.fcgi Roqxc78252SgtTvp] [info] "WebRequest: took 0.5ms"

Actions #1

Updated by Mamadou Babaei over 11 years ago

I also forgot to mention that when the file is larger than 128 K fileTooLarge() is emitted. I don't know why Wt does not pickup my config?

[2012-Oct-19 20:58:37.810287] 90334 - [info] "WServer/wtfcgi: initializing relay server"

[2012-Oct-19 20:58:37.812685] 90334 - [info] "config: reading Wt config file: /srv/samsungdforum.ir/lib/wt/etc/wt/wt_config.xml (location = '/srv/samsungdforum.ir/www/root.fcgi')"

[2012-Oct-19 20:58:37.814688] 90334 - [info] "wtfcgi: spawned session process: pid = 90335"

[2012-Oct-19 20:58:37.815192] 90334 - [info] "wtfcgi: reading FastCGI stream from stdin"

[2012-Oct-19 20:58:38.149343] 90335 - [info] "WServer/wtfcgi: initializing shared wtfcgi session process"

Actions #2

Updated by Mamadou Babaei over 11 years ago

I believe I found the reason for this, this bug is related to wt_config.xml handling.

I have no /etc/wt/wt_config.xml, then I am giving the path to wt_config.xml when spawning my process like this.

$ cd {WWW_ROOT} && WT_CONFIG_XML={/PATH/TO/wt_config.xml} /usr/local/bin/spawn-fcgi -d {WWW_ROOT} -s {/PATH/TO/SOCKET} -n -M {PERMISSIONS} -u {WWW_USER} -g {WWW_GROUP} --- 4 &

As you can see it got picked up (at least log says so):

[2012-Oct-19 21:15:29.833880] 93042 - [info] "WServer/wtfcgi: initializing relay server"

[2012-Oct-19 21:15:29.836194] 93042 - [info] "config: reading Wt config file: /srv/samsungdforum.ir/lib/wt/etc/wt/wt_config.xml (location = '/srv/samsungdforum.ir/www/root.fcgi')"

[2012-Oct-19 21:15:29.838019] 93042 - [info] "wtfcgi: spawned session process: pid = 93043"

[2012-Oct-19 21:15:29.838526] 93042 - [info] "wtfcgi: reading FastCGI stream from stdin"

[2012-Oct-19 21:15:30.177850] 93043 - [info] "WServer/wtfcgi: initializing shared wtfcgi session process"

Then I made a copy of my config file to /etc/wt/ and tried to respawn the process:

[2012-Oct-19 21:07:06.389451] 91681 - [info] "WServer/wtfcgi: initializing relay server"

[2012-Oct-19 21:07:06.391857] 91681 - [info] "config: reading Wt config file: /srv/samsungdforum.ir/lib/wt/etc/wt/wt_config.xml (location = '/srv/samsungdforum.ir/www/root.fcgi')"

[2012-Oct-19 21:07:06.393727] 91681 - [info] "wtfcgi: spawned session process: pid = 91682"

[2012-Oct-19 21:07:06.394232] 91681 - [info] "wtfcgi: reading FastCGI stream from stdin"

[2012-Oct-19 21:07:06.740514] 91682 - [info] "config: reading Wt config file: /etc/wt/wt_config.xml (location = '/srv/samsungdforum.ir/www/root.fcgi')"

[2012-Oct-19 21:07:06.742545] 91682 - [info] "WServer/wtfcgi: initializing shared wtfcgi session process"

As you can see it picked up two config files; one in /srv/samsungdforum.ir/lib/wt/etc/wt/wt_config.xml and the last one in /etc/wt/wt_config.xml

Then my app and the WFileUpload works as expected.

According to http://www.webtoolkit.eu/wt/doc/reference/html/overview.html#fastcgi:

The following locations for the wt_config.xml configuration file are considered, in this order:

  • value of environment variable $WT_CONFIG_XML
  • within the app root, as configured by the environment variable $WT_APP_ROOT: $WT_APP_ROOT/wt_config.xml
  • the compile-time default (/etc/wt/wt_config.xml)

The strange thing is Wt ignores my configuration file on both scenario !?

Since it does make sense to have separate config files not a global one for separate Wt-Apps I believe this is a bug.

Actions #3

Updated by Koen Deforche over 11 years ago

  • Status changed from New to Feedback

Hey,

If I interpret your finding well, then the child process spawned by FastCGI (the 'session process') is not considering the environment variables ? Is that also your interpretation ?

Regards,

koen

Actions #4

Updated by Mamadou Babaei over 11 years ago

Hi,

Unfortunately I don't know about internal parts of Wt, But from what I saw on the log output I believe the spawned process picks up the WT_CONFIG_XML variable (at least log says so) but ignores it:

[2012-Oct-19 21:15:29.833880] 93042 - [info] "WServer/wtfcgi: initializing relay server"

[2012-Oct-19 21:15:29.836194] 93042 - [info] "config: reading Wt config file: /srv/samsungdforum.ir/lib/wt/etc/wt/wt_config.xml (location = '/srv/samsungdforum.ir/www/root.fcgi')"

[2012-Oct-19 21:15:29.838019] 93042 - [info] "wtfcgi: spawned session process: pid = 93043"

[2012-Oct-19 21:15:29.838526] 93042 - [info] "wtfcgi: reading FastCGI stream from stdin"

[2012-Oct-19 21:15:30.177850] 93043 - [info] "WServer/wtfcgi: initializing shared wtfcgi session process"

Actions #5

Updated by Koen Deforche over 11 years ago

  • Status changed from Feedback to Resolved
  • Assignee set to Koen Deforche
  • Target version set to 3.2.3

Hey,

I believe that indeed in the case of non _GNU_LIBC, we were not passing on the environment to the spawned child process. I've fixed this now in my git copy.

Regards,

koen

Actions #6

Updated by Mamadou Babaei over 11 years ago

Thank you so much. I'm going to check out your git repository. :)

Actions #7

Updated by Koen Deforche over 11 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF