00:06 <+ddnet-discord> @heinrich5991 each ASYNCIO gets it's own thread? 00:06 <+ddnet-discord> yes 00:07 <+ddnet-discord> did it like that because they can block for arbitrary amount of time and you can't check whether they'll block 00:07 <+ddnet-discord> (no nonblocking mode for files) 00:07 <+ddnet-discord> they? 00:08 <+ddnet-discord> the disk IO operations 00:08 <+ddnet-discord> or at least that's what deen told me 00:08 <+ddnet-discord> can't you return if block on disk IO? 00:08 <+ddnet-discord> no 00:08 <+ddnet-discord> I checked that 00:08 <+ddnet-discord> hmm stupid assumption they made 00:08 <+ddnet-discord> all disk io doesn't have to be fast 00:09 <+ddnet-discord> anyway, it shouldn't be a lot of overhead. the threads take up no CPU until woken up by more input 00:10 <+ddnet-discord> looks like a perfect place to use condition variables 😛 shame they don't work on windows xp 00:10 <+ddnet-discord> yes :/ 00:10 <+ddnet-discord> just use c++11 ? 00:11 <+ddnet-discord> not in system.c you don't 😛 00:11 <+ddnet-discord> not in `system.c` you don't 😛 00:11 <+ddnet-discord> @heinrich5991 if you feel up to it maybe a good time to start `system.cpp` 00:12 <+ddnet-discord> mh. I was happy that I could do without 😃 00:12 <+ddnet-discord> You know me I'm all for keeping to C 00:12 <+ddnet-discord> because this makes it more likely that teehistorian is merged into other mods 00:14 <+ddnet-discord> I could check out the condition-variable implementation of gcc or clang on windows 00:15 <+ddnet-discord> I think they use semaphores 00:15 <+ddnet-discord> https://www.microsoft.com/en-us/research/wp-content/uploads/2004/12/ImplementingCVs.pdf 00:18 <+ddnet-discord> if you refuse to switch to system.cpp what about adding CVs using c++11 here: https://github.com/ddnet/ddnet/blob/master/src/base/tl/threading.h ? 00:18 <+ddnet-discord> @heinrich5991 what is the two buffers for? 00:19 <+ddnet-discord> @HMH feel free to add system.cpp once you need it, I won't block it 00:19 <+ddnet-discord> @Learath2 when the thread that writes to the queue needs to create a bigger buffer, it can't delete the old buffer right away 00:19 <+ddnet-discord> because the thread reading from the queue might still have pointers into the buffer 00:19 <+ddnet-discord> wait wait wait there is a thread that writes to the queue? 00:19 <+ddnet-discord> the main thread 00:20 <+ddnet-discord> oh 00:20 <+ddnet-discord> mh? 00:20 <+ddnet-discord> I mean there should be someone writing, right? ^^ 00:20 <+ddnet-discord> I thought you had another thread that was coordinating the writing threads, was like how did I miss that one 00:21 <+ddnet-discord> nono 00:21 <+ddnet-discord> the "writer" is the main thread that wants to output stuff into files, the "reader" is the dedicated thread that forwards the things into a file 00:22 <+ddnet-discord> (in my terminology) 00:22 <+ddnet-discord> is this even safe? you write to buf1 from one thread while the other is possibly `io_write`ing what's in buf1 00:22 <+ddnet-discord> I'm writing disjoint areas of the same array 00:22 <+ddnet-discord> shouldn't atleast the length associated to the buffer be lock protected? 00:23 <+ddnet-discord> yes, it is 00:23 <+ddnet-discord> well 00:23 <+ddnet-discord> so 00:23 <+ddnet-discord> the lock is held everytime someone does something with the array, except while `io_write`ing the stuff 00:24 <+ddnet-discord> (because that would make the extra thread useless) 00:25 <+ddnet-discord> the queue reader only updates its (lock-protected) read pointer when it is done `io_write`ing the contents into the file 00:25 <+ddnet-discord> the queue writer only writes until the buffer is full, and at that point, it increases the buffer size by switchting to a new buffer 00:25 <+ddnet-discord> side-line: all the extra braces makes this really hard to read for me 00:25 <+ddnet-discord> extra braces? 00:26 <+ddnet-discord> the ones in `buffer_len` e.g. 00:26 <+ddnet-discord> ah 00:26 <+ddnet-discord> yea, always writing braces doesn't look too well in our braces style 00:26 <+ddnet-discord> so used to omiting them for oneliners it looks disjointed 😛 00:28 <+ddnet-discord> I decided to just always write them and never look for braces errors anymore 00:28 <+ddnet-discord> it works better in the 00:28 <+ddnet-discord> ``` 00:28 <+ddnet-discord> if(abc) { 00:28 <+ddnet-discord> return 1; 00:28 <+ddnet-discord> } else { 00:28 <+ddnet-discord> foobar(); 00:28 <+ddnet-discord> } 00:28 <+ddnet-discord> ``` 00:28 <+ddnet-discord> style 00:30 <+ddnet-discord> eeh, don't think I ever made a brace error 00:31 <+ddnet-discord> been a while since I've seen a brace mistake in ##c either 00:31 <+ddnet-discord> don't really want to get sidetracked into this discussion unless you really want to 00:31 <+ddnet-discord> anyways, what is "Don't allow full queue to distinguish between empty and full queue." supposed to mean? 00:31 <+ddnet-discord> we can get sidetracked about braces later 😄 00:31 <+ddnet-discord> 🙂 00:32 <+ddnet-discord> don't fill the queue completely – full queue looks the same as empty queue, read_pos == write_pos 00:33 <+ddnet-discord> how does that work? write_pos wraps back? 00:33 <+ddnet-discord> yes 00:33 <+ddnet-discord> ``` 00:33 <+ddnet-discord> ###### 00:33 <+ddnet-discord> W R 00:33 <+ddnet-discord> ``` 00:33 <+ddnet-discord> ``` 00:33 <+ddnet-discord> ######### 00:33 <+ddnet-discord> W R 00:33 <+ddnet-discord> ``` 00:34 <+ddnet-discord> this means that the queue is filled from the R, wrapping around to the W 00:34 <+ddnet-discord> why is it filled from R? read_pos sounds like where you are io_writing from 00:35 <+ddnet-discord> yes 00:35 <+ddnet-discord> I'm `io_write`ing from `R` to `W` 00:35 <+ddnet-discord> the reader is behind the writer 00:35 <+ddnet-discord> it still has to read all the stuff the writer has written 00:35 <+ddnet-discord> In your picture about R is ahead of W, how does that happen? 00:36 <+ddnet-discord> when the buffer has wrapped around 00:36 <+ddnet-discord> the writer wrote 6 bytes, the reader read 6 bytes, the writer writes 6 bytes 00:36 <+ddnet-discord> so you are kinda using it like a circular buffer? 00:36 <+ddnet-discord> yes 00:36 <+ddnet-discord> except when it gets filled, then I create a larger buffer 00:38 <+ddnet-discord> do you have a max size somewhere? 00:39 <+ddnet-discord> no 00:39 <+ddnet-discord> I hopefully crash on allocation failure 00:39 <+ddnet-discord> but not checked, as indicated in the comment 00:39 <+ddnet-discord> Is it a good idea to crash on a logging failure? 00:39 <+ddnet-discord> it is a good idea to crash on teehistorian failure 00:40 <+ddnet-discord> logging -- maybe not 00:40 <+ddnet-discord> mhh 00:41 <+ddnet-discord> maybe a forced blocking flush for teehistorian and a skip for logging? 00:41 <+ddnet-discord> crashing vs blocking probably doesn't matter too much, in any case the race is fucked up 00:42 <+ddnet-discord> I could perhaps introduce a max size 00:42 <+ddnet-discord> for the queue 00:42 <+ddnet-discord> well would blocking kill everyones connection? 00:43 <+ddnet-discord> you have blocked long enough to have filled the teehistorian buffer, which is probably at least multiple 10MBs 00:43 <+ddnet-discord> that's probably as much as such a server produces in a day 00:44 <+ddnet-discord> I'll see if I can introduce a max size 00:44 <+ddnet-discord> (that will need another notification in the other direction, to let the reading thread wake up the writing thread) 00:45 <+ddnet-discord> the buffer is somehow full, you blocking flush in tick, no more data is generated by teehistorian, how bad can io be honestly 00:45 <+ddnet-discord> frozen server is better then crashed server no? 00:46 <+ddnet-discord> yea 00:46 <+ddnet-discord> actually if it never unfreezes it's worse then crashing 😄 00:46 <+ddnet-discord> true 00:48 <+ddnet-discord> is there a reason you don't do a realloc? 00:48 <+ddnet-discord> yes. I still need the old buffer for the reader 00:48 <+ddnet-discord> it might currently do a `io_write` with the old buffer 00:49 <+ddnet-discord> oh, another counter-argument against checking for OOM: none of the other code does it, so that will crash when we check for it (?) 00:49 <+ddnet-discord> we run our servers on linux with overcommit, so `malloc` failure isn't really a thing there 00:50 <+ddnet-discord> true 00:52 <+ddnet-discord> @heinrich5991 so buf1 and buf2 are just convenience pointers right? 00:52 <+ddnet-discord> yes 00:52 <+ddnet-discord> I just wrote that code to reuse it somewhere else 00:52 <+ddnet-discord> I think I call that function in two places 00:57 <+ddnet-discord> you use old_buffer to make sure the buffer doesn't get free'd while `io_write`ing right? 00:57 <+ddnet-discord> yes 01:01 <+ddnet-discord> Q:resizing the buffer "straightens out" the buffer, if `io_write` was using the `old_buffer` how do you sync up the `read_pos` and `write_pos` to the new buffer? You also don't seem to check the return of `io_write` is it right to assume the entire buffer was written? 01:02 <+ddnet-discord> I sync the `read_pos` and `write_pos` to the new buffer by just setting `read_pos` to 0 01:02 <+ddnet-discord> the reading thread will always just add the length of the buffer it just wrote to `read_pos` after it is done 01:02 <+ddnet-discord> (while the stuff is locked, so the writing thread isn't interfering) 01:04 <+ddnet-discord> unless an error occurs, I think `fwrite` always writes the full number of bytes 01:08 <+ddnet-discord> what is refcount for? 01:08 <+ddnet-discord> depending on what exits first, the reading thread or the writing thread 01:08 <+ddnet-discord> the `aio` structure should only be freed after both exited 01:10 <+ddnet-discord> you decrement refcount at only one function and only call that function once per aio no? 01:11 <+ddnet-discord> I call that function in two places 01:11 <+ddnet-discord> once from the reading thread, and once from the writing thread 01:11 <+ddnet-discord> (just search for the function name) 01:11 <+ddnet-discord> oh missed that one, sry gh website doesn't like my searches 01:11 <+ddnet-discord> sometimes it decides not to show stuff that I can't currently see 01:11 <+ddnet-discord> mh ~~ 01:19 <+ddnet-discord> you know what would be cute? a goto for cleanup in `async_new` 01:19 <+ddnet-discord> thought so too 😄 01:19 * ddnet-discord <3 goto 01:20 <+ddnet-discord> but then I remembered our lack of gotos 01:20 <+ddnet-discord> we only use it in the sql stuff and that stuff all looks horrible anyways 😛 01:21 <+ddnet-discord> especially the save/load thing, awful style, weird use of return codes 01:49 <+ddnet-discord> @Learath2 any more questions? probably going to bed soon 01:49 <+ddnet-discord> nope, submitted my first review 😛 01:51 <+ddnet-discord> ty, will check that out tomorrow 01:51 <+ddnet-discord> I should also get some sleep, gn8 01:51 <+ddnet-discord> nite 11:30 <+ddnet-discord> @Dr. Jekyll I've installed windows 10, but the process I described in the forums works fine for me 11:31 <+ddnet-discord> we could get back to debugging somewhen soon 14:09 <+ddnet-discord> Dangit 14:09 <+ddnet-discord> Im happy to keep using standalone git&cmake, it works at least 14:09 <+ddnet-discord> tho im still failing travis 14:13 <+ddnet-discord> i don't think like you did something wrong 14:13 <+ddnet-discord> it says, that cmake isn't working 14:13 <+ddnet-discord> ```Dependencies: 14:13 <+ddnet-discord> -- * Curl found 14:13 <+ddnet-discord> -- * Freetype found 14:13 <+ddnet-discord> -- * GTest not found 14:13 <+ddnet-discord> -- * Ogg not found (using bundled version) 14:13 <+ddnet-discord> -- * Opus not found (using bundled version) 14:13 <+ddnet-discord> -- * Opusfile not found (using bundled version) 14:13 <+ddnet-discord> -- * PythonInterp found 14:13 <+ddnet-discord> -- * SDL2 not found 14:13 <+ddnet-discord> -- * Zlib found 14:13 <+ddnet-discord> CMake Error at CMakeLists.txt:169 (message): 14:13 <+ddnet-discord> You must install SDL2 to compile the DDNet client``` 14:13 <+ddnet-discord> Did you change antything in travis ? 14:13 <+ddnet-discord> it's for macos no? 14:14 <+ddnet-discord> I changed nothing 14:14 <+ddnet-discord> i know, you didn't 14:14 <+ddnet-discord> and yeah, it says something about macos and packages 14:14 <+ddnet-discord> i asking our boss 14:14 <+ddnet-discord> @HMH? 😄 16:49 <+ddnet-discord> @noby about the old discussion: I made ddnet client send input more often because people had tricks to simulate lots of direct inputs using keyboard macros, so the pros did it with any client. 16:49 <+ddnet-discord> this was relevant when you're in freeze and press a or d 16:50 <+ddnet-discord> https://github.com/ddnet/ddnet/commit/c4118a3878bbba1584c054bd53fccb453273af6d 16:50 <+ddnet-discord> (but only in freeze, so with ninja) 16:50 <+ddnet-discord> but other clients could change that of course 18:35 <+ddnet-discord> im trying to compile ddnet source with bam 18:35 <+ddnet-discord> i build the project 18:36 <+ddnet-discord> in visual studio 18:36 <+ddnet-discord> when i try to compile client_release tho 18:36 <+ddnet-discord> theres an error 18:39 <+ddnet-discord> "The program 18:39 <+ddnet-discord> "c:\...\ddnet\client_release\ddnet.exe" cannot be started 18:39 <+ddnet-discord> The system cannot find the file" 18:43 <+ddnet-discord> looks like there's no file called ddnet..exe 18:44 <+ddnet-discord> y 18:44 <+ddnet-discord> ik that 18:45 <+ddnet-discord> so 18:45 <+ddnet-discord> maybe you are trying to run ddnet.exe 18:45 <+ddnet-discord> instead of compile