MantisBT - opensim
View Issue Details
0007817opensim[REGION] OpenSim Corepublic2016-01-23 01:582017-04-14 12:24
master (dev code) 
Grid (Multiple Regions per Sim)
.NET / Windows32
Firestorm, Singularity
0007817: file_get_contents no longer works with 0.9.x on simstatus page
The php function "file_get_contents" no longer works correctly with OpenSim v0.9.x. You can test it with the script provided below.

If you try OpenSim v0.8.x everything works properly, normal speed
If you try OpenSim v0.9.x it does NOT works properly, very very slow speed

edit : work perfectly with curl
    $url = "http://IP:PORT/simstatus/"; [^]
    $simstatus = file_get_contents($url);
    if ($simstatus == "OK") echo "Online";
    else echo "Offline";
No tags attached.
Issue History
2016-01-23 01:58djphilNew Issue
2016-01-26 04:36djphilDescription Updatedbug_revision_view_page.php?rev_id=5225#r5225
2016-01-27 00:46JeffKelleyNote Added: 0030027
2016-01-27 01:33djphilNote Added: 0030028
2016-01-27 01:34djphilNote Edited: 0030028bug_revision_view_page.php?bugnote_id=30028#r5227
2016-06-14 08:35djphilNote Added: 0030521
2016-06-21 09:40DivaNote Added: 0030619
2016-06-21 10:20djphilNote Added: 0030628
2016-06-21 10:24DivaNote Added: 0030629
2016-06-21 10:36DivaNote Edited: 0030629bug_revision_view_page.php?bugnote_id=30629#r5566
2016-06-21 10:53djphilNote Added: 0030630
2016-06-21 11:19djphilNote Edited: 0030630bug_revision_view_page.php?bugnote_id=30630#r5568
2017-04-14 12:24djphilNote Added: 0031752
2017-04-14 12:24djphilStatusnew => resolved
2017-04-14 12:24djphilFixed in Version => master (dev code)
2017-04-14 12:24djphilResolutionopen => fixed
2017-04-14 12:24djphilAssigned To => djphil
2017-04-14 12:24djphilStatusresolved => closed

2016-01-27 00:46   
From [^]

Bear in mind that contrary to the behavior of web browsers, file_get_contents doesn't return the result when the web page is fully downloaded (i.e. HTTP payload length = value of the response HTTP "Content-Length" header) but when the TCP connection is closed.


tcpdump makes clear that file_get_contents is still waiting for [FIN, ACK] when the HTTP response has been received one minute ago.

Although OS HTTP server answers 'Connection: close' in all versions, it does not actually close the connection since commit bcb27d4 or over. Try: [^] /* 0.9 bcb27d4 2015-11-15 */ [^] /* 0.9 109723d 2016-01-26 */

Also note that this behaviour is the rule for LSL scripts in all versions, so file_get_contents will timeout for 0.8 scripts also.

Using Content-Length to detect end of conversation, curl is not subject to this issue.
2016-01-27 01:33   
(edited on: 2016-01-27 01:34)
I hope that we can find file_get_contents as it worked well in the past with 0.8.x
Quite simply ...

2016-06-14 08:35   
I re test the php function "file_get_contents" today with the Master Dev code to get simstats content but i see any changes for now.

Before, in OpenSim v0.8.x it was working fine but it does not work v0.9.x

Think you can make it work properly as it was before ?
2016-06-21 09:40   
If this is a regression, I'd like to fix it.
However, I will not be able to fix anything that involves PHP.

So, please restate this issue in a way that I can see what the problem is. I don't do PHP. Start with this:

- How do I enable simstatus?
- What's the expected return from calling http://IP:PORT/simstatus/? [^]
- What do you get that is erroneous in 0.9 but ok in 0.8.2?
2016-06-21 10:20   
simstatus is enable by default and i don't remember where disable it
(i know this is possible).

if enable it will return "OK"
( [^])

in OS v0.9.x the response time is huge and causes a timeout error.
2016-06-21 10:24   
(edited on: 2016-06-21 10:36)
Unable to reproduce. The response is immediate on my test grids, both localhost and on a university server.

I used a web browser. If that doesn't do it, please provide another way for me to reproduce the problem that is not PHP.

2016-06-21 10:53   
(edited on: 2016-06-21 11:19)
In the [Network] section i have this port for 0.9
http_listener_port = 12100
and this port for 0.8
http_listener_port = 12000

So I tested with the script provided above
with the urls http://mydomain:12000/simstatus/ [^]
and http://mydomain:12100/simstatus/ [^]

PS: i send to you a url url in IM on IRC

2017-04-14 12:24   
New test repport:
- Tested with opensim master (2017-04-14) in STANDALONE mode and in GRID mode [^] [^]
- OS : Windows 7 (32bits)
- .NET Framework : 4.6.2
- Tested with the PHP script provided above

It is working properly again :)