Guild icon
DDraceNetwork
Development / developer
Development discussion. Logged to https://ddnet.tw/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2017-10-11 00:00:00Z and 2017-10-12 00:00:00Z
Avatar
<Nimda> Offpanic by Themix just released on Brutal at 2017-10-11 19:52
Avatar
<laxa> !ddnet
18:50
<laxa> !ddnetpeak
18:50
<Nimda> Current players on DDNet : 368
18:50
<Nimda> Current DDNet peak : 810 users online at 2015-04-26 20:11:01
Avatar
https://github.com/ddnet/ddnet/pull/880/commits Now i've failed 2 out of 3 what the heck
Create modifiable group clipping Add a list of clipping areas to map file using new editor window (enable cl_editorcliptrigger 1) -These consist of tune zone, trigger id, clip x,y,w&h, disableclipp...
Avatar
std:: ?
19:06
or maybe you are usign function which are not included
Avatar
It compiles locally
Avatar
soo maybe, you have newer version 😮
19:07
don't think so
Avatar
can you sactually see where the errors are occurring
Avatar
in editor.cpp
19:09
there's no #include <string.h> but
19:09
im not C dev, so maybe it should inherit from somewhere else
Avatar
Where have i added anything from there in editor.cpp
19:10
strcmp?
Avatar
hmmmmmmmmmm
Avatar
and memset in
19:11
anyway
19:11
just go there
19:11
and expand bam release error log
Avatar
@Dr. Jekyll you shouldn't use string.h in Teeworlds code, use functions from system.h instead
Avatar
#include <base/system.h> ?
Avatar
str_comp replaces strcmp, memset(x, 0, y) is replaced by mem_zero(x, y)
Avatar
both memset and strcmp are used im other places not by me
Avatar
only in code that doesn't adhere to the common style – we'd accept PRs to fix that
19:40
where?
Avatar
server.cpp 78
19:41
478
Avatar
introduced by GreYFoX
19:42
that's been a while. he didn't care too much about code style
Avatar
file_score.cpp 166
19:42
ill just use your qrapper then
19:42
wrapper
Avatar
memset is used 5 times in the code, mem_zero 162 times
19:45
strcmp 3, str_comp 319
19:45
:]
Avatar
I found interesting site http://styleguides.io/
Avatar
generally: work with the style of the surrounding cod
19:54
e
Avatar
doppel peace an @heinrich5991
Avatar
@heinrich5991 each ASYNCIO gets it's own thread?
Avatar
yes
22:07
did it like that because they can block for arbitrary amount of time and you can't check whether they'll block
22:07
(no nonblocking mode for files)
Avatar
they?
Avatar
the disk IO operations
22:08
or at least that's what deen told me
Avatar
can't you return if block on disk IO?
Avatar
no
22:08
I checked that
Avatar
hmm stupid assumption they made
22:08
all disk io doesn't have to be fast
Avatar
anyway, it shouldn't be a lot of overhead. the threads take up no CPU until woken up by more input
Avatar
looks like a perfect place to use condition variables 😛 shame they don't work on windows xp
Avatar
yes :/
Avatar
just use c++11 ?
Avatar
not in system.c you don't 😛 (edited)
22:11
@heinrich5991 if you feel up to it maybe a good time to start system.cpp
👍 1
Avatar
mh. I was happy that I could do without 😃
Avatar
You know me I'm all for keeping to C
Avatar
because this makes it more likely that teehistorian is merged into other mods
22:14
I could check out the condition-variable implementation of gcc or clang on windows
Avatar
I think they use semaphores
Avatar
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 ?
ddnet - DDraceNetwork, a mod of Teeworlds
Avatar
@heinrich5991 what is the two buffers for?
Avatar
@HMH feel free to add system.cpp once you need it, I won't block it
22:19
@Learath2 when the thread that writes to the queue needs to create a bigger buffer, it can't delete the old buffer right away
22:19
because the thread reading from the queue might still have pointers into the buffer
Avatar
wait wait wait there is a thread that writes to the queue?
Avatar
the main thread
Avatar
mh?
22:20
I mean there should be someone writing, right? ^^
Avatar
I thought you had another thread that was coordinating the writing threads, was like how did I miss that one
Avatar
nono
22:21
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
22:22
(in my terminology)
Avatar
is this even safe? you write to buf1 from one thread while the other is possibly io_writeing what's in buf1
Avatar
I'm writing disjoint areas of the same array
Avatar
shouldn't atleast the length associated to the buffer be lock protected?
Avatar
yes, it is
22:23
well
22:23
so
22:23
the lock is held everytime someone does something with the array, except while io_writeing the stuff
22:24
(because that would make the extra thread useless)
22:25
the queue reader only updates its (lock-protected) read pointer when it is done io_writeing the contents into the file
22:25
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
Avatar
side-line: all the extra braces makes this really hard to read for me
Avatar
extra braces?
Avatar
the ones in buffer_len e.g.
Avatar
ah
22:26
yea, always writing braces doesn't look too well in our braces style
Avatar
so used to omiting them for oneliners it looks disjointed 😛
Avatar
I decided to just always write them and never look for braces errors anymore
22:28
it works better in the
22:28
if(abc) { return 1; } else { foobar(); }
22:28
style
Avatar
eeh, don't think I ever made a brace error
22:31
been a while since I've seen a brace mistake in ##c either
Avatar
don't really want to get sidetracked into this discussion unless you really want to
Avatar
anyways, what is "Don't allow full queue to distinguish between empty and full queue." supposed to mean?
22:31
we can get sidetracked about braces later 😄
22:32
don't fill the queue completely – full queue looks the same as empty queue, read_pos == write_pos
Avatar
how does that work? write_pos wraps back?
Avatar
yes
22:33
######### W R (edited)
22:34
this means that the queue is filled from the R, wrapping around to the W
Avatar
why is it filled from R? read_pos sounds like where you are io_writing from
Avatar
yes
22:35
I'm io_writeing from R to W
22:35
the reader is behind the writer
22:35
it still has to read all the stuff the writer has written
Avatar
In your picture about R is ahead of W, how does that happen?
Avatar
when the buffer has wrapped around
22:36
the writer wrote 6 bytes, the reader read 6 bytes, the writer writes 6 bytes
Avatar
so you are kinda using it like a circular buffer?
Avatar
yes
22:36
except when it gets filled, then I create a larger buffer
Avatar
do you have a max size somewhere?
Avatar
no
22:39
I hopefully crash on allocation failure
22:39
but not checked, as indicated in the comment
Avatar
Is it a good idea to crash on a logging failure?
Avatar
it is a good idea to crash on teehistorian failure
22:40
logging -- maybe not
22:40
mhh
Avatar
maybe a forced blocking flush for teehistorian and a skip for logging?
Avatar
crashing vs blocking probably doesn't matter too much, in any case the race is fucked up
22:42
I could perhaps introduce a max size
22:42
for the queue
Avatar
well would blocking kill everyones connection?
Avatar
you have blocked long enough to have filled the teehistorian buffer, which is probably at least multiple 10MBs
22:43
that's probably as much as such a server produces in a day
22:44
I'll see if I can introduce a max size
22:44
(that will need another notification in the other direction, to let the reading thread wake up the writing thread)
Avatar
the buffer is somehow full, you blocking flush in tick, no more data is generated by teehistorian, how bad can io be honestly
22:45
frozen server is better then crashed server no?
Avatar
yea
Avatar
actually if it never unfreezes it's worse then crashing 😄
Avatar
true
Avatar
is there a reason you don't do a realloc?
Avatar
yes. I still need the old buffer for the reader
22:48
it might currently do a io_write with the old buffer
22:49
oh, another counter-argument against checking for OOM: none of the other code does it, so that will crash when we check for it (?)
22:49
we run our servers on linux with overcommit, so malloc failure isn't really a thing there
22:52
@heinrich5991 so buf1 and buf2 are just convenience pointers right?
Avatar
yes
22:52
I just wrote that code to reuse it somewhere else
22:52
I think I call that function in two places
Avatar
you use old_buffer to make sure the buffer doesn't get free'd while io_writeing right?
Avatar
yes
Avatar
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?
Avatar
I sync the read_pos and write_pos to the new buffer by just setting read_pos to 0
23:02
the reading thread will always just add the length of the buffer it just wrote to read_pos after it is done
23:02
(while the stuff is locked, so the writing thread isn't interfering)
23:04
unless an error occurs, I think fwrite always writes the full number of bytes
Avatar
what is refcount for?
Avatar
depending on what exits first, the reading thread or the writing thread
23:08
the aio structure should only be freed after both exited
Avatar
you decrement refcount at only one function and only call that function once per aio no?
Avatar
I call that function in two places
23:11
once from the reading thread, and once from the writing thread
23:11
(just search for the function name)
Avatar
oh missed that one, sry gh website doesn't like my searches
23:11
sometimes it decides not to show stuff that I can't currently see
Avatar
mh ~~
Avatar
you know what would be cute? a goto for cleanup in async_new
Avatar
thought so too 😄
Avatar
<3 goto
Avatar
but then I remembered our lack of gotos
Avatar
we only use it in the sql stuff and that stuff all looks horrible anyways 😛
23:21
especially the save/load thing, awful style, weird use of return codes
Avatar
@Learath2 any more questions? probably going to bed soon
Avatar
nope, submitted my first review 😛
Avatar
ty, will check that out tomorrow
Avatar
I should also get some sleep, gn8
Avatar
nite
Exported 186 message(s)