Page 1 of 1

bug:Limited mods node def. 0.4 20120106-1 (beta patch provided)

PostPosted: Sun Jan 08, 2012 21:02
by redcrab
After several test to make mesecons and seasons to be available on my server, I'm a bit confused with the issue.

There is no crash ,
I didn't see anything relevant on client and server sides...
the symptoms are :

Client didn't get any "Node definitions" and bad texture loading progress
screenshot from 20120102 but same with 20120106
Image
then the world is only made with "unknown blocks"
Image

Then to find out the issue I've reduced at minimum the Season mods with only
this init.lua code
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_node("seasons:treehead", {
    tile_images = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
    inventory_image = minetest.inventorycube("default_tree_top.png", "default_tree.png", "default_tree.png"),
    is_ground_content = true,
    material = minetest.digprop_woodlike(1.0),
    dug_item = 'node "tree" 1',
})


There is no issue !

I've replaced the code with the following
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_node("seasons:ice", {
    tile_images = {"seasons_ice.png"},
    inventory_image = minetest.inventorycube("seasons_ice.png"),
    is_ground_content = true,
    material = minetest.digprop_woodlike(1.0),
    dug_item = '',
})


There is no issue !
But if I combine these two register_node
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_node("seasons:treehead", {
    tile_images = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
    inventory_image = minetest.inventorycube("default_tree_top.png", "default_tree.png", "default_tree.png"),
    is_ground_content = true,
    material = minetest.digprop_woodlike(1.0),
    dug_item = 'node "tree" 1',
})

minetest.register_node("seasons:ice", {
    tile_images = {"seasons_ice.png"},
    inventory_image = minetest.inventorycube("seasons_ice.png"),
    is_ground_content = true,
    material = minetest.digprop_woodlike(1.0),
    dug_item = '',
})


The issue occurs ...
There is no crash nor assert()

So there is a limit somewhere , but what and where, and what can we do ?

PostPosted: Mon Jan 09, 2012 15:54
by randomproof
Delete the debug.txt file and run the server and shut it down after after loading and check the debug.txt for errors. If you don't find any redo this with the client connecting and then check the debug.txt file again for errors.

PostPosted: Mon Jan 09, 2012 19:43
by redcrab
as suggested by randomproof I 've made several execution and collect debug.txt
I collected debug when ok and collected debug when not ok (just one more node definition)

here my diagnostic..

As stated on my first post, no error no warning (differences between ok and not ok)

Then some differences:

When issue occurs
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
INFO[ServerThread]: Server::SendToolDef(): Sending tool definitions: size=1772
INFO[ServerThread]: Server::SendNodeDef(): Sending node definitions: size=100046
INFO[ServerThread]: Server::SendCraftItemDef(): Sending craft item definitions: size=5776


When ok (with one node less (smaller node definition size))
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
INFO[ServerThread]: Server::SendToolDef(): Sending tool definitions: size=1772
INFO[ServerThread]: Server::SendNodeDef(): Sending node definitions: size=99680
INFO[ServerThread]: Server::SendCraftItemDef(): Sending craft item definitions: size=5776




when ok this following line exist .. but no line alike exists when not ok.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
INFO[main]: Client: Received node definitions: packet size: 99680


I should expect one line with
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
INFO[main]: Client: Received node definitions: packet size: 100046


Node definition never sent data without doing any error ... or Node definition received but ignore it without any error ... and this only when packet size go over 100000 bytes ?

I suspect something around con::Connection::send(...) and makeSplitPacket but can't find out what... :(

Does somebody else get same behaviour ?
I don't know what to do next... I'm not a good troubleshooter and not a skilly programmer...

PostPosted: Mon Jan 09, 2012 20:49
by randomproof
I think there is a packet size limit. Doing a quick search on 100000 found this, but I'm not sure this is where the problem is. The way that the server and clients communicate is very complex. So try increasing this number and see if that helps.

connection.cpp, line 669
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
// Receive packets from the network and buffers and create ConnectionEvents
void Connection::receive()
{
    u32 datasize = 100000;    <------  HERE
    // TODO: We can not know how many layers of header there are.
    // For now, just assume there are no other than the base headers.
    u32 packet_maxsize = datasize + BASE_HEADER_SIZE;     <------  HERE
    SharedBuffer<u8> packetdata(packet_maxsize);

    bool single_wait_done = false;

PostPosted: Mon Jan 09, 2012 22:33
by redcrab
Gotcha it works !

I've replaced
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
u32 datasize = 100000;


by
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
u32 datasize = 200000;  // I ve enough memory ;)



Don't know if this fix code should be integrated into mainstream (every body do not place so much mods ! and may have not so much memory resources)

But It could be cool if this size limit can be place inside minetest.con with a default at 100000
And also cool to make a assert with a message to say that a too big packet is dropped ..
"Too big packet 100042 > 100000 remove mods or change minetest.conf maxpacketsize parameter" something alike ;)

PostPosted: Mon Jan 09, 2012 22:43
by randomproof
I think the networking code for minetest is way too complicated and needs a rewrite. Maybe I'll take a whack at it some time in the not so near future, but don't hold your breath.

PostPosted: Mon Jan 09, 2012 23:14
by redcrab
I see that modification is mandatory not for the server but for the client ... So I can't say to my players it is fixed ... The good way is to wait an mainstream version of the client with the fix/rewrite...

PostPosted: Tue Jan 10, 2012 17:13
by redcrab
just in case if celeron55 or major dev contributor would like to make available the patch to every body.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
diff --git a/src/connection.cpp b/src/connection.cpp
index b9c5d2a..b0a6faa 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -666,7 +666,7 @@ void Connection::send(float dtime)
 // Receive packets from the network and buffers and create ConnectionEvents
 void Connection::receive()
 {
-    u32 datasize = 100000;
+    u32 datasize = 200000;
     // TODO: We can not know how many layers of header there are.
     // For now, just assume there are no other than the base headers.
     u32 packet_maxsize = datasize + BASE_HEADER_SIZE;

PostPosted: Wed Jan 11, 2012 08:05
by Jordach
thanks.

PostPosted: Wed Jan 11, 2012 11:03
by kahrl
Doubling datasize is not a solution. You'll hit the same roadblock again after you double your number of mods.

Could you try the following?
* Set datasize to 1000. (Yes, the number of 0s on that is correct!)
* Comment out lines 857 to 859, it looks like that check is bogus.

PostPosted: Wed Jan 11, 2012 12:16
by redcrab
awesome, your suggestion is nicer and it works !

this patch do not take account my previous patch (this patch have to be applied from mainstream git version)

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
diff --git a/src/connection.cpp b/src/connection.cpp
index b9c5d2a..2c134b9 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -666,7 +666,7 @@ void Connection::send(float dtime)
 // Receive packets from the network and buffers and create ConnectionEvents
 void Connection::receive()
 {
-       u32 datasize = 100000;
+       u32 datasize = 1000;
        // TODO: We can not know how many layers of header there are.
        // For now, just assume there are no other than the base headers.
        u32 packet_maxsize = datasize + BASE_HEADER_SIZE;
@@ -854,9 +854,9 @@ void Connection::receive()
                        dout_con<<"ProcessPacket returned data of size "
                                        <<resultdata.getSize()<<std::endl;
                       
-                       if(datasize < resultdata.getSize())
-                               throw InvalidIncomingDataException
-                                               ("Buffer too small for received data");
+//             if(datasize < resultdata.getSize())
+//                             throw InvalidIncomingDataException
+//                                             ("Buffer too small for received data");
                       
                        ConnectionEvent e;
                        e.dataReceived(peer_id, resultdata);

PostPosted: Wed Jan 11, 2012 15:32
by randomproof
It seems to me it would be easier to send the size of a packet as a 32 bit integer before sending the actual packet so you don't need a hard-coded receive size. There are so many send and receive functions, I'm not sure where best to do this, though.

PostPosted: Wed Jan 11, 2012 16:43
by jn
FYI, kahrl has a protocol-level fix for this in his itemdef patchset:
http://celeron.55.lt/~celeron55/minetest/wiki/doku.php?id=changes:itemdef:code (src/connection.cpp)
I haven't tested it, though.

PostPosted: Sat Jan 14, 2012 05:03
by jordan4ibanez
set u32 datasize = 100000;
to u32 datasize = 900000;
:D

PostPosted: Sat Jan 14, 2012 16:02
by Jordach
jordan4ibanez wrote:set u32 datasize = 100000;
to u32 datasize = 900000;
:D


:O, thats got to be a lotta mods!

PostPosted: Sat Jan 14, 2012 18:57
by jordan4ibanez
not really :P but i like to keep leeway incase i add a lot more..people who join my server only need to patch to 200000 though :)