lisdude / toaststunt Goto Github PK
View Code? Open in Web Editor NEWA network accessible, multi-user, programmable, interactive system for the creation of MOOs / MUDs.
A network accessible, multi-user, programmable, interactive system for the creation of MOOs / MUDs.
Hi there,
if a player is in a garbage object, it appears to cause a memory error (signall 11), after around 5 to 10 seconds of the player trying to do stuff.
HTH, though calling move(obj, new_location) fixes it and doesn't break, it is still something I noticed.
HTH
( Opening this issue here, as suggested by DistantOrigin )
Ever since the change to using switch_player instead of return, I've noticed that the MOO no longer displays the *** Connected ***, *** Created *** and *** Redirecting *** messages. While I wouldn't call it an issue per say, it is a little annoying given that I rely on those strings for certain triggers. My suggestion is to make switch_player actually print these strings, similar to how return does.
What if switch_player was updated to accept a third (optional) argument, whether or not to silently perform the switch? Not providing this argument would default to silent being 0.
Is this possible? Am I being too anal?
Thanks in advance!
Could we have an addition to options.h to say whether to use the last_move prop or not? It's useful on smaller databases, but can really blote bigger ones, :) It's a great feature though. Would be even better if we could have it in $server_options.enable_last_move, but I'm thinking that could get complicated.
The current functionality of curl is considerably limited and presently generates only HTTP get requests. Unfortunately, this method alone is not enough to allow for effective communication with REST APIs. As such, there is a need for increased HTTP functionality in the form of:
Post -- Use to request that the server accept data.
Put -- Use to (more explicitly) request that the server accept data. The difference primarily derives from the assumptions the server is allowed to make.
Delete -- Use to request that a server delete the specified entity.
Trace -- Use to request that the server send back received data. Useful for testing and diagnostic.
The behavior for these HTTP methods are well-documented here: https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
As a final thought; The bare-minimum implementation of both get and post would allow for any MOO-driven API to grow vastly in complexity.
Hi there,
I was wondering if the experts of the server side world would take a look at the preserve newlines patch, I've uploaded it with this issue.
Now, obviously, the patch itself is wildly out of date, especially considering it was made for lambdamoo, not toast.
But I wanted to touch on the principle of the matter in so far as how it escapes the \n and \r\n strings to stop the breaking of the database structure overall.
In toaststunt, I've seen it put ~0A in place of newlines in exec for instance, so would this work for the case of this patch?
EG instead of:
case '\n':
fputc('\0', output);
fputc('n', output);
You'd have:
fputc('~0A1', output);
I'm assuming it'd have to be a call to fputc for each character in ~0A1 but you get the idea.
My questions are:
Thoughts welcome.
preserve-newlines.patch.txt
I think it would be very useful to have a way to force WAIFs to be destroyed. For example, I have noticed that if WAIFs send text to players, references to them can get caught in places like the paranoid database, which prevents them from being destroyed. Maybe an invalidate function, or maybe an extension to the recycle function.
Wasn't sure where to put this, and if this isn't the place let me know.
Is there a way the server could have a size check implemented for its logger? So if size of log exceeds $server_options.max_log_size, then close it, zip it up, and open a fresh file, repeat as necessary?
I'm not sure if the mud closes the database.log file after writing to it off the top of my head, and part of me wants to say it doesn't, which is why I am pretty sure having an external program do this would be a veryveryvery bad idea.
Thanks for your time and attention to this matter.
sqlite_execute is returning syntax errors, but not runtime errors.
For example, on a table with "NOT NULL" fields:
;sqlite_query(3,"insert into boards(name) values ('Robbie')") returns => "NOT NULL constraint failed: boards.desc"
;sqlite_execute(3,"insert into boards(name) values (?)",{"Robbie"}) returns => {}
Since {} is the expected result for an insert, this can make debugging very difficult.
Looking at sqlite.cc, the issue appears here:
sqlite.cc, line 397: rc = sqlite3_step(stmt);
The following lines only check for rc==SQLITE_ROW
and there is no explicit error handling.
It does check the handle, and it does check for errors on the sqlite3_prepare_v2
, but is failing to check for runtime errors being thrown by the sqlite3_step call.
This means that an insert that has runtime errors (ie, constraints) fails silently, which is not a lot of fun.
Hello,
So the latter, compound assignment operators, is something I've been really interested in for some time. It is surprising that it seems to take a back seat in moo especially as they are pretty well standard in modern languages, even not so modern if I am honest.
If I understand things correctly (probably not) this would be modifications of code_gen.cc and disassemble.cc?
The second question for that ties into the second subject, additional prepositions.
As far as I can find the only place the list of prepositions supported by the server is in db_verbs.cc.
There are some missing from this list, for example, behind, amongst etc. Use cases:
Hide behind door
put cat amongst pidgins.
I realise this can largely be managed with verb args of any any any and then doing a syntax check there, and likewise probably something can be lifted to use regexp for the compound assignment within the moo itself, but primarily, for both of tese I was wondering if there was a design reason to leave these out?
Thanks
Hi, this isn't an issue I just am not sure where to turn. The ansi system doesn't replace tags for $login:welcome (presumably because a not-logged-in-player doesn't have ansi options enabled) and digging through the $ansi code, I'm not sure how to make it happen. I've tried a myriad of hacks to try to get it to work, but I keep seeing my ansi tags in my welcome message. Is this really tricky to pull off? If someone could point me in the direction of where to start reading, it'd be super appreciated.
I just experienced a bug in the built-in function toobj()
For instance, if you evaluate ;toobj("root") (or whatever string), it returns the system object #0, but it should be returned #-1 <$nothing> instead.
Hi there
I've been doing some work recently patching in one or two things (attempting for instance utf8), but I appear to have partly broken read().
I'm trying to trace it down as it works up to the point where the player logs in and becomes a positive object number, and after that will always return an empty string.
Where d the two separate?
Thanks
In src/network.cc line 464 if a telnet sequence does not end before the end of a single packet it is both ignored, and then further content is read as if it were a regular command, corrupting the next command.
Telnet option sequences can be longer than a single packet, and so this is not working correctly.
We may explore using libtelnet rather than implementing our own state machine to parse this properly, but that has its own downsides, as Libtelnet seems to want to fully take over the connection and we still want to be able to handle telnet commands in-MOO.
Setup:
Test verb:
set_thread_mode(1);
handle = random(1, 2);
while (true)
pattern = chr(random(65, 90)) + chr(random(65, 90)) + chr(random(65, 90)) + chr(random(65, 90));
m = chr(random(65, 90)) + chr(random(65, 90)) + chr(random(65, 90)) + chr(random(65, 90));
query = tostr("select regexp('", pattern, "', '", m, "');");
sqlite_query(handle, query);
yin();
endwhile
The MOO should panic pretty quickly.
I'm guessing this is caused by multiple threads trying to access the PCRE cache at the same time.
I've had several occasions where a database has crashed with a sigpipe (broken pipe). It can stay up a month or a day but at some point it crashes. I have TLS defined in options.h and also the verification of peers is enabled. Previously, with these disabled, the same source has ran a db for months a few times without crashing.
The crashes happen when the game decrements the nhandle refcounts in network.cc (I'll get the exact lines as soon as I can). It can attempt to write to a closed connection and cause sigpipe. It tries to push output to the nhandle.
Currently, there's no way to bind to a specific interface or IP address in listen()
.
If we have a listener that's only meant to listen on localhost (e.g. designed to be used with stunnel), there's no way to do this other than with a firewall.
Hi,
Wanted to thank lisdude, Todd, and all contributors for the amazing work done on Stunt/ToastStunt. I notice SQLite is chosen rather than MySQL, even though MOOSQL has enjoyed some popularity over the years. MOOSQL makes blocking calls, which is a bummer, and also doesn't support prepared statements.
Two things:
background.cc
) that is MOOSQL bf compatible (and also supported prepared statements) for MySQL. Is such a patch welcome in ToastStunt or is this against the philosophy of ToastStunt in some fashion?Thanks again, for the amazing work.
Best,
Ryan
This panic is caused when SQLITE_SANITIZE_STRINGS is enabled and there is an empty column in the database.
Code to reproduce:
handle = sqlite_open("test1.db",8);
sqlite_query(handle, "CREATE TABLE `test` (col1 integer, col2 text, col3 integer);");
sqlite_execute(handle, "INSERT INTO `test` (col1,col2) VALUES (?,?);", {1,"text"});
sqlite_execute(handle,"SELECT * FROM `test`;", {});
Background threads suspending presents problems in suspends happening in forked code where a suspend is not desired. This falls into side-effect function problems.
Recommendation is to change things like sort:: into non-background thread functions and instead use C++17's parallel processing execution methods.
https://en.cppreference.com/w/cpp/algorithm/sort
and
std::execution::par_unseq
https://en.cppreference.com/w/cpp/algorithm/execution_policy_tag
This will still net a significant performance gain while removing the side effect code smell that can cause issues with sort.
I currently get the following if I define LOG_COMMANDS in src/include/options.h file: ( #define LOG_COMMANDS
)
.../toaststunt/src/log.cc: In function ‘void add_command_to_history(Objid, const char*):
.../toaststunt/src/log.cc:195:16: error: ‘info’ declared as reference but not initialized
195 | struct tm &info;
| ^~~~
make[2]: *** [CMakeFiles/moo.dir/build.make:601: CMakeFiles/moo.dir/src/log.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/moo.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
Thanks!
The problem here is that ssl_write() wants the exact same arguments as the first time it was run after SSL_ERROR_WANT_WRITE. Unfortunately, when MAX_QUEUED_OUTPUT is exceeded, that output is unceremoniously tossed out and we can't give it back to ssl_write(). This results in SSL_ERROR_SSL (ssl3_write_pending:bad write retry) and the connection is closed.
Right now the best worst idea I have is to store h->output_head in push_output() when it encounters SSL_ERROR_WANT_WRITE. The next invocation will prune the output based on MAX_QUEUED_OUTPUT, as expected, but we'll still have sufficient information for ssl_write() to continue. After we repeat whatever was in the original output_head, we can clear that and continue as normal. I think this will work, but it seems a bit workaroundy.
Any smarter ideas?
You can reproduce this by connecting to ToastCore via TLS and evaling something like: ;for x in [1..10000] me:tell($wiz_utils:random_password(30)); yin(); endfor
Intersecting two lists or sets would make an amazing built-in especially if it used a bloom filter algorithm, as it would be incredibly fast on what is sometimes a very close algorithm.
Unions, diffs, and intersections would all make great builtins, being common operations.
Please find log from
mkdir build
cd build
cmake ..
attached. I mentioned this on the Discord, but nobody there knew the solution.
When I run cmake it fails to find standard C include files like sys/types.h, etc. They're in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include instead of the more usual UNIX /usr/include. I tried adding a line set(CMAKE_OSX_SYSROOT "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk") to CMakeLists.txt and setting an environment variable with the same name/value, but that didn't work.
Trying to install on a fresh ubuntu.
After cmake, the make command stops at 62%with:
/home/MOO/toaststunt/src/network.cc:389:5: error: expected unqualified-id before ‘if’
389 | if (count > 0) {
| ^~
/home/MOO/toaststunt/src/network.cc:440:7: error: expected unqualified-id before ‘else’
440 | } else {
| ^~~~
/home/MOO/toaststunt/src/network.cc:444:1: error: expected declaration before ‘}’ token
444 | }
| ^
make[2]: *** [CMakeFiles/moo.dir/build.make:653: CMakeFiles/moo.dir/src/network.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/moo.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
hi there,
So I was running a server the other day, when I noticed this pop up:
*** Waiting for network I/O: Bad file descriptor
During this time, nothing could connect to h the mud, though I'm assuming it carried on running as normal.
left it over night, and got up the next morning, it was working fine.
Huge log file, mind you.
thanks for any help
In order to programmatically edit MOOcode from within the MOO it is necessary to expose a representation of the AST.
I propose a new verb_ast(obj, vrb) builtin which returns a map of maps, each representing an AST node.
While it would be possible to render the AST maps back into MOOcode server-side, I also propose a set_verb_ast builtin which will work equivalently to set_verb_code, just with AST nodes.
Similar to the existing unparse infrastructure we can add functions like unparse_stmt_ast which call down into subfunctions like unparse_scatter_ast and so on.
Would such a patch be accepted?
The docs say this is by design (and follows for verb_info(), and verbs()), but I have to ask why! Inevitably, lambdamoo stuff is going to have object inheritance. Do I really need to write my own util function to while loop up the tree? Yes, I can do this, but this is going to be a lot less efficient than if it's done inside the underlying C++? Is there any way we could have a flag added to these functions, which cause them to check if a verb exists at all for the given object?
I have a db that I am running on lambdamoo v1.8.2 will this server support that db structure?
Hello,
The title says it all pretty much.
This used to happen quite a lot and recently the issue just started popping up again.
Randomly through what is for me the night the mud will just stop accepting connections from outside (it still allows localhost, 0.0.0.0 and 127.0.0.0 to connect). When ever someone tries to connect externally it shows in the log:
Nov 9 02:04:20: *** Accepting new network connection: Invalid argument
This morning when fixing the issue I noticed 14 files in file_handles() had not been shut properly, so I went ahead and shut those, not sure if it is relevant or not.
Server version: "2.7.0_3"
$server_options.no_name_lookup = 1
Thanks in advance.
Title rpretty much says it all.
To be honest with websockets you could code around it if there was a way to receive SSL data and decode it. Most web browsers enforce WSS for websockets now, And I've yet to figure out a way to handle SSL data over do_login_command for a web request without fancy footwork outside of the MOO itself.
But truly, cutting out the middle man and just adding websocket support would be amazing if anyone is up for the challenge.
I've got the server up and running with ToastCore. I created a pet rock and gave it the description, "A small [blue]rock." Yet I don't see the word rock in blue on my client. The bracketed blue is stripped out, so I merely see, "A small rock." This same client can display color from other moo games. Can anyone advise me how to configure my server to correctly send color text?
Hi there,
I was wondering what changes does toast stunt actually make to the database as compared to the normal stunt?
thanks
Hi Folks,
This is just to raise awareness that there seems to be a large memory leak with the latest versin of the server.
there also seems to be some database changes between 16 and 17 (well obviously) but I'm not sure at which change these came in?
The memory leak is extremely serious and I'm assuming it's related to networking.
Interestingly, when ever I compile with LeakCheck or Debug it actually won't boot, it loads the database, listens, and then crashes.
I'm assuming this was introduced at the latest network changes?
Wondering if someone can advise a way to role bak temporarily or if 17 came with the network changes.
thanks
I am really still new on programming in this architecture. But I have a suggestion:
ANSI is quite nice, but it does not support special characters or umlauts or other diacritical characters.
It would be great for other languages if you could implement UTF8 (maybe instead of ANSI?), please.
Thank you very much for the great, genious project to keep it up to date the server code and work on a new database.
random(-5,5) -> INVARG.
This is undesired functionality, especially because c++ supports this just fine.
Likely just need to change bf_random to something like
`static package
bf_random(Var arglist, Byte next, void *vdata, Objid progr)
{
int nargs = arglist.v.list[0].v.num;
Num minnum = (nargs == 2 ? arglist.v.list[1].v.num : 1);
Num maxnum = (nargs >= 1 ? arglist.v.list[nargs].v.num : INTNUM_MAX);
free_var(arglist);
if (maxnum < minnum)
return make_error_pack(E_INVARG);
std::uniform_int_distribution<Num> distribution(minnum, maxnum);
Var r = Var::new_int(distribution(rng));
return make_var_pack(r);
}`
I have some code that connects to other servers, and connects to an object, rather than calling read().
I noticed that the object wasn't being properly cleaned up when the server restarted, so I put in some debugging code in the verb.
I found that it was getting extremely low object numbers (E.G. #-8771237084393373721), instead of the correct one (#-25 in this case).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.