Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
183 user(s) are online (157 user(s) are browsing Forums)

Members: 0
Guests: 183

more...

Support us!

Headlines

 
  Register To Post  

« 1 2 3 4 (5) 6 »
Re: MineCraft (MineTest) work in progress help need it
Not too shy to talk
Not too shy to talk


See User information
@kas1e

I removed -lgai from Makefile and now it compiles.

I also created a "test world"

However I got this error:
Mod Error: Mod Security: Blocked attempted read from BACKUP-1:Games/minetest/builtin/common/strict.lua


Edited by SinanSam460 on 2021/4/19 10:33:49
Sinan - AmigaOS4 Beta-Tester
- AmigaOne X5000
- AmigaOne A1222
- Sam460ex
Go to top
Re: MineCraft (MineTest) work in progress help need it
Home away from home
Home away from home


See User information
@Sinan
With removing -gai you link against those functions in the newlib => issues.

And nope, it didn't works with local gaming as well (because of that threaded network issues, for details check latest 5-7 posts about)

As for Mod Error Mod Security, that can be disabled in config.

But for real until we didn't deal with those network issues, all other issues can wait, as if we didn't deal with network threading code it all make no sense then :(

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: MineCraft (MineTest) work in progress help need it
Just popping in
Just popping in


See User information
@kas1e

the port is dead?

Go to top
Re: MineCraft (MineTest) work in progress help need it
Home away from home
Home away from home


See User information
@sinisrus
Everything stopped at the moment with problems with the network. I do not know if they are endian related or not, or (which is very possible too) roadshow related, but I fear if it roadshow related, fix is near to impossible.

I will definitely give another go for, as there was a lot of time spent to, but when dunno. Not right now, as have other projects to finish first which looks more possible to finish.

I also may try to come from another side, and find out something who can work on it on a payment basis (someone from minetest team), but that is just an idea.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: MineCraft (MineTest) work in progress help need it
Just popping in
Just popping in


See User information
@kas1e

For first time without network is not possible to play ?

Go to top
Re: MineCraft (MineTest) work in progress help need it
Home away from home
Home away from home


See User information
@sinisrus
Quote:

For first time without network is not possible to play ?


Nope, even for "local" play, it uses network code to create a server on localhost, etc.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: MineCraft (MineTest) work in progress help need it
Home away from home
Home away from home


See User information
@All
I want to resurrect this thing again after Andrea spend lots of time on clib2, in hope to see if it will behave anyhow different in compare with newlib.

But then, i meet with some strange problem which can be minetest itself of new clib2, dunno.

Issue is: once i run game, thins inititializes, window creates, etc, and minetest start to ask for use local inbuild (and a bit changed) lua lib functions, it crashes.

It didn't crash for real like "GR" or so, with all that registers stuff, but game itself throw that:

ERROR [Main]: /minetst_clib2/src/script/cpp_api/s_base.cpp:52 ScriptApiBase:ScriptApiBase(ScriptingType): A Fatal error occured: liaL_newstate() failed.

And tis s_base.cpp: 52 is:

class ModNameStorer
{
private:
    
lua_State *L;
public:
    
ModNameStorer(lua_State *L_, const std::string &mod_name):
        
L(L_)
    {
        
// Store current mod name in registry
        
lua_pushstring(Lmod_name.c_str());
        
lua_rawseti(LLUA_REGISTRYINDEXCUSTOM_RIDX_CURRENT_MOD_NAME);
    }
    ~
ModNameStorer()
    {
        
// Clear current mod name from registry
        
lua_pushnil(L);
        
lua_rawseti(LLUA_REGISTRYINDEXCUSTOM_RIDX_CURRENT_MOD_NAME);
    }
};



Line 52 is that "lua_State *L;" in private part.

With Newlib as i say all works fine, but it can be of course issue and with game, and with new clib2, but need to find out why it crashes at all there and why it didn't work.

I recall that i have this kind of issue somewhere someday, but can't remember what it was. But it seems something brutal, like non initialized base of library or so, while, of course it should, as it's not amiga libraries, but simple .a lib statically linked with..

Any ideas and help apprecated !

After it will start to works, we can compare if it the same over clib2 bugged when create a server, or not. If yes, then continue to debug, if not, then good for us.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: MineCraft (MineTest) work in progress help need it
Just can't stay away
Just can't stay away


See User information
@kas1e

Line number seems incorrect. If you look where the error message comes from, it should be in a different place. It should also be possible to debug the failing lua call, at least using printf.

Is this lua library code also compiled using the same C library?

Go to top
Re: MineCraft (MineTest) work in progress help need it
Home away from home
Home away from home


See User information
@all
Ok, pure build of latest lua and their 2 binaries "lua" and "luac" behave also weird with new clib2, while ok with newlib. So or there bug in clib2 , or it matter of different "ifdefs" and some other code of lua compiles , which isn't for newlib.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: MineCraft (MineTest) work in progress help need it
Home away from home
Home away from home


See User information
@All
Andrea fixed issue , it was new version of "setjmp" assembler routines from newlib, by some reassons the crash, so Andrea rewert old one back: https://github.com/afxgroup/clib2/comm ... efbcfd771e031237b275ce879


Now i was able to build minetest over clib2, and , of course it the same crashes as with newlib when i tried to create a game (so it tried to create a server), and crash exactly of the same kind : heavy freeze of the OS, most of time without crashlog, or with some "crazy" crashlog.

I of course first think about network code being wrong, but, fetching list of the servers works, they lists fine, etc. So at least network basically works. But we crash when start a game and it about to create/connect to the server.

Asked on mintest forum if game is endian aware, and they say that "In general the code is written to be endian independent, but probably nobody has verified this to work in years.". Not very promising, but at least they know what Endians is, and that they have no special little-endian parts.

So.. damn printf again ?:)

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: MineCraft (MineTest) work in progress help need it
Home away from home
Home away from home


See User information
@all

For now found only that : when we run a game we create a server, which is simple:

bool Game::createSingleplayerServer(const std::string &map_dir,
        const 
SubgameSpec &gamespecu16 portstd::string *address)
{
    
showOverlayMessage(N_("Creating server..."), 05);

    
std::string bind_str g_settings->get("bind_address");
    
Address bind_addr(0000port);

    
server = new Server(map_dirgamespecsimple_singleplayer_modebind_addrfalse);
    
server->init();
    
server->start();
    return 
true;
}



Adding prinfs with delays, find out that we freeze right once we call server->start().


Both server::init and server::start use threads and mutexes. So issues can be there , or can be not . There are server::init one:

void Server::init()
{
    
infostream << "Server created for gameid \"" << m_gamespec.id << "\"";
    if (
m_simple_singleplayer_mode)
        
infostream << " in simple singleplayer mode" << std::endl;
    else
        
infostream << std::endl;
    
infostream << "- world:  " << m_path_world << std::endl;
    
infostream << "- game:   " << m_gamespec.path << std::endl;

    
// Create world if it doesn't exist
    
if (!loadGameConfAndInitWorld(m_path_worldm_gamespec))
        throw 
ServerError("Failed to initialize world");

    
// Create server thread
    
m_thread = new ServerThread(this);

    
// Create emerge manager
    
m_emerge = new EmergeManager(this);

    
// Create ban manager
    
std::string ban_path m_path_world DIR_DELIM "ipban.txt";
    
m_banmanager = new BanManager(ban_path);

    
m_modmgr std::unique_ptr<ServerModManager>(new ServerModManager(m_path_world));
    
std::vector<ModSpecunsatisfied_mods m_modmgr->getUnsatisfiedMods();
    
// complain about mods with unsatisfied dependencies
    
if (!m_modmgr->isConsistent()) {
        
m_modmgr->printUnsatisfiedModsError();
    }

    
//lock environment
    
MutexAutoLock envlock(m_env_mutex);

    
// Create the Map (loads map_meta.txt, overriding configured mapgen params)
    
ServerMap *servermap = new ServerMap(m_path_worldthism_emerge);

    
// Initialize scripting
    
infostream << "Server: Initializing Lua" << std::endl;

    
m_script = new ServerScripting(this);

    
m_script->loadMod(getBuiltinLuaPath() + DIR_DELIM "init.lua"BUILTIN_MOD_NAME);

    
m_modmgr->loadMods(m_script);

    
// Read Textures and calculate sha1 sums
    
fillMediaCache();

    
// Apply item aliases in the node definition manager
    
m_nodedef->updateAliases(m_itemdef);

    
// Apply texture overrides from texturepack/override.txt
    
std::vector<std::stringpaths;
    
fs::GetRecursiveDirs(pathsg_settings->get("texture_path"));
    
fs::GetRecursiveDirs(pathsm_gamespec.path DIR_DELIM "textures");
    for (const 
std::string &path paths)
        
m_nodedef->applyTextureOverrides(path DIR_DELIM "override.txt");

    
m_nodedef->setNodeRegistrationStatus(true);

    
// Perform pending node name resolutions
    
m_nodedef->runNodeResolveCallbacks();

    
// unmap node names for connected nodeboxes
    
m_nodedef->mapNodeboxConnections();

    
// init the recipe hashes to speed up crafting
    
m_craftdef->initHashes(this);

    
// Initialize Environment
    
m_env = new ServerEnvironment(servermapm_scriptthism_path_world);

    
m_clients.setEnv(m_env);

    if (!
servermap->settings_mgr.makeMapgenParams())
        
FATAL_ERROR("Couldn't create any mapgen type");

    
// Initialize mapgens
    
m_emerge->initMapgens(servermap->getMapgenParams());

    if (
g_settings->getBool("enable_rollback_recording")) {
        
// Create rollback manager
        
m_rollback = new RollbackManager(m_path_worldthis);
    }

    
// Give environment reference to scripting api
    
m_script->initializeEnvironment(m_env);

    
// Register us to receive map edit events
    
servermap->addEventReceiver(this);

    
m_env->loadMeta();

    
m_liquid_transform_every g_settings->getFloat("liquid_update");
    
m_max_chatmessage_length g_settings->getU16("chat_message_max_size");
    
m_csm_restriction_flags g_settings->getU64("csm_restriction_flags");
    
m_csm_restriction_noderange g_settings->getU32("csm_restriction_noderange");
}


And there are server::start() one:

void Server::start()
{
    
// Stop thread if already running
    
m_thread->stop();

    
// Initialize connection
    
m_con->SetTimeoutMs(30);
    
m_con->Serve(m_bind_addr);

    
// Start thread
    
m_thread->start();

}



So, have anybody any idea what next? Functions really didn't looks that heavy , they should work, the only difference from usual usage is threading and mutexes.

Maybe for sake of test trying to remove them ?

Any help and ideas apprecated.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: MineCraft (MineTest) work in progress help need it
Home away from home
Home away from home


See User information
@All

Maybe it worth somehow to try to recreate test case from this code snippets ? That way we may see if it threading or not.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: MineCraft (MineTest) work in progress help need it
Just popping in
Just popping in


See User information
I am curious what is in the sent package indeed and what is transferred by roadshow. Is this input properly serialised ? But... I am sure you tried to check it.

Go to top
Re: MineCraft (MineTest) work in progress help need it
Home away from home
Home away from home


See User information
@All
Ok some sort of progress.

Firstly, minetest have set of "tests" , running via "minetest --run-unittests". it testing there threading, sockets, connectsion, serialization, etc, etc.

So i run it, and it simple freeze too after some tests passed, and this freeze is random (can happens early after threading/socket checks, can happens a bit later). I then remove test by test to find out the guilty one, and this is : test_connection.cpp, there is:

https://github.com/minetest/minetest/b ... ttest/test_connection.cpp

It containt 3 tests , and the failing one is TestConnection::testConnectSendReceive(), there :

https://github.com/minetest/minetest/b ... /test_connection.cpp#L160


So that explain our freeze when we about to start a game and create a server and connect to.

Next, adding prinfs with delay after each string, and find out that freeze happens because of "server.Serve(address);" , that on line 191.

This "Serve(...)" thing is in the connection.cpp:

https://github.com/minetest/minetest/b ... work/connection.cpp#L1389

And we crash exactly when we do putCommand() call.


Edited by kas1e on 2022/5/10 7:35:42
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: MineCraft (MineTest) work in progress help need it
Just popping in
Just popping in


See User information
@kas1e
are you able to printf content ( partially at least ) of this putCommand ? Is anything in it at all ? I am still afraid it is something around serialization or syntax.
to gummy duck:
You are able to get server info...
but not able to put server id...
It means server cant recognize input...
or server has recognized but your app didn't connect properly... you should be able to printf what server gets

Go to top
Re: MineCraft (MineTest) work in progress help need it
Home away from home
Home away from home


See User information
@Arthas
Quote:

are you able to printf content ( partially at least ) of this putCommand ? Is anything in it at all ? I


putCommand is just:

void Connection::putCommand(ConnectionCommand &c)
{
    if (!
m_shutting_down) {
        
m_command_queue.push_back(c);
        
m_sendThread->Trigger();
    }
}


Do you mean some content of "c" right before putCommand(c) ? But ConnectionCommand pretty big stuff (see connection.h)..


@All
I debug it a bit more, added printfs/delays to the putCommand(), and it crashes exactly on this line:

m_sendThread->Trigger();

And Trigger() are (see connectionthreads.cpp):

void ConnectionSendThread::Trigger()
{
    
m_send_sleep_semaphore.post();
}


Just for sake of to be sure i added prinfs/delays before and after this m_send_sleep_semaphore.post(); call, and yeah, can confirm that one where things freezes.

"m_send_sleep_semaphore" is "Semaphore m_send_sleep_semaphore;" (from connectionthreads.h).


And "Semaphore" is:


class Semaphore
{
public:
    
Semaphore(int val 0);
    ~
Semaphore();

    
DISABLE_CLASS_COPY(Semaphore);

    
void post(unsigned int num 1);
    
void wait();
    
bool wait(unsigned int time_ms);

private:
#if defined(WIN32)
    
HANDLE semaphore;
#elif defined(__MACH__) && defined(__APPLE__)
    
semaphore_t semaphore;
#else
    
sem_t semaphore;
#endif
};


And our "post" , is:

void Semaphore::post(unsigned int num)
{
    
assert(num 0);
#ifdef _WIN32
    
ReleaseSemaphore(semaphorenumNULL);
#else
    
for (unsigned i 0numi++) {
        
int ret sem_post(&semaphore);
        
assert(!ret);
        
UNUSED(ret);
    }
#endif
}


Now .. go figure what wrong with semaphores and why they freezes.

But what i can see there, that it take "int" as input, and then signals semaphores, but we do call it from Trigger() without any value, just as "post()" , so maybe something wrong there ..


Edited by kas1e on 2022/5/10 19:34:30
Edited by kas1e on 2022/5/10 19:41:38
Edited by kas1e on 2022/5/10 19:47:16
Edited by kas1e on 2022/5/10 19:54:16
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: MineCraft (MineTest) work in progress help need it
Just popping in
Just popping in


See User information
@kas1e

Quote:
But what i can see there, that it take "int" as input, and then signals semaphores, but we do call it from Trigger() without any value, just as "post()" , so maybe something wrong there ..

num is given a default value of 1 in the declaration of Semaphore:

void post(unsigned int num 1);

So if you call post() without a parameter it should use the default. You could add a printf to confirm that.

The problem is probably in the call to sem_post(&semaphore);.

Go to top
Re: MineCraft (MineTest) work in progress help need it
Home away from home
Home away from home


See User information
@msteed
Quote:

So if you call post() without a parameter it should use the default. You could add a printf to confirm that.


You are right, i have "int = 1" in the .post() when it called without parameter.

Interesting that when i do run "threading" tests: https://github.com/minetest/minetest/b ... ittest/test_threading.cpp , then in the second test called testAtomicSemaphoreThread() , we have there "num 4" for calling 4 times .post , and it works fine, no freezes.

But it do cal .post one time, i.e. one time with "num 4".

But in our case when we test network send/recv, we do call .post one time with num 1 (yeah defaul), and it pass fine, then, we do call this post second time, again with num = 1 as default, and this time we freezes on "sem_post(&semaphore).

I do not know why it call .post second time (and from where), but i can see, that Semaphore::~Semaphore() is not called after first call, that for sure.

"sem_post" in our semaphore's implementation are : int sem_post(sem_t *sem);

Semaphore implementation is http://os4depot.net/?function=showfil ... /library/misc/libpsem.lha , with source code included. But i assume only Frederik as author can have an idea wtf ..

Maybe issue when we calling .post few times and not one time ? But then the only difference is calling of function, which do almost nothing but sem_post ..

Maybe it may wort to wrote new "unit_test" for minetest, where experiment with different .post usage, so by this way we can see if something with our semaphores implementation or it only happens when it used with network.


Edited by kas1e on 2022/5/11 7:02:30
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: MineCraft (MineTest) work in progress help need it
Just popping in
Just popping in


See User information
@kas1e

The code for sem_post() isn't terribly complicated. Since the same code seems to work most of the time (and presumably in other projects as well), I'm guessing that's not where the problem lies. So two possibilities come to mind.

1. The semaphore (sem_t) that's being passed to sem_post() is getting clobbered by something. sem_post() makes a number of Exec calls, passing pointers obtained from the semaphore. If one or more of those pointers is invalid, it could potentially cause a crash.

2. Presumably there's another thread somewhere that's sem_wait()ing on the semaphore. That thread wakes up when sem_post() posts to the semaphore, and that thread does something that causes the crash. The crash is not caused by the post, it's just triggered by it.

Go to top
Re: MineCraft (MineTest) work in progress help need it
Home away from home
Home away from home


See User information
@msteed
Quote:

(and presumably in other projects as well),


I never use anywhere posix semaphores, it is first time i meet with them in minetest. Frederik made this library exactly when i ask about in this thread and then fixing it few times.

Very simple test cases passes, yeah, but recv/send one cause a hardcore freeze, without crashlog, without anything on serial, mean that something really heavy happens.

Quote:

So two possibilities come to mind.


Question is how to find it without debugger, what to prinfs and where.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top

  Register To Post
« 1 2 3 4 (5) 6 »

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project