<flux>
also seems it doesn't do multipart responses natively, so that also needs to be built on top of regular responses (required when requesting multiple ranges)
<flux>
but maybe nothing does those requests :)
tautologico has joined #ocaml
picolino has quit [Remote host closed the connection]
picolino has joined #ocaml
nicholasf has quit [Remote host closed the connection]
<flux>
but it leaks file descriptors if the transfer isn't completed (ie. client disconnects)
<flux>
is there something I'm missing? it seems other examples also just do the same thing, ie. use Lwt_strema.from and then close the file with Lwt_stream.on_termination
<flux>
of course the way around that is to open the file for each block it reads, but..
<flux>
the way to reproduce it is to put in the file name of a big media file to line 68, ocamlbuild --use-ocamlfind kodipush.native; ./kodipush.native and then mpv --no-cache http://localhost:8000/foo
<flux>
after seeking around a bit lsof -p $(pidof kodipush.native) will show the media file is open multiple times
<flux>
(I guess mplayer works as well, perhaps with -no-cache)
<flux>
(also the files stay open even after the player exits)
<flux>
rgrinberg, that multipart support seems to be for client side, not server side.. though client side is probably more complicated and more important anyway :)
<flux>
maybe one way would be to hack Server.make ~conn_closed:(...) but is that really the way..
<flux>
(probably by making a weak hash table from conns to my auxiliary data structure containing the list of active fds and closing them in the handler)
tautologico has joined #ocaml
Pieter_ has joined #ocaml
Pieter_ has quit [Client Quit]
seangrove has quit [Ping timeout: 276 seconds]
<mrvn>
FDs should be a custom block with finalizer.
ollehar has quit [Ping timeout: 264 seconds]
tautologico has quit [Ping timeout: 258 seconds]
orbifx1 has quit [Ping timeout: 258 seconds]
<rgrinberg>
flux: just to get it clear, are you looking to encode or decode multipart bodies?
darkf has joined #ocaml
kandu has joined #ocaml
GeoffSK has joined #ocaml
<GeoffSK>
Hi - i am tying use Time.Span. I am using batteries, Do I need to use Std?
jmasseo has quit [Remote host closed the connection]
inr has quit [Ping timeout: 240 seconds]
cschneid has quit [Ping timeout: 250 seconds]
tautologico has joined #ocaml
cschneid has joined #ocaml
clog has quit [Ping timeout: 240 seconds]
GeoffSK has quit [Quit: Thanks, i am leaving]
tautologico has quit [Ping timeout: 276 seconds]
tmtwd has joined #ocaml
sh0t has quit [Remote host closed the connection]
nicholasf has joined #ocaml
slash^ has joined #ocaml
tmtwd has quit [Ping timeout: 260 seconds]
cheater has quit [Quit: leaving]
tmtwd has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
ollehar has joined #ocaml
jonasen has joined #ocaml
tmtwd has quit [Ping timeout: 258 seconds]
mattrepl has quit [Quit: mattrepl]
fluter has quit [Ping timeout: 258 seconds]
tautologico has joined #ocaml
rgrinberg has quit [Ping timeout: 276 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
tane has joined #ocaml
xaimus has quit [Remote host closed the connection]
tmtwd has joined #ocaml
tautologico has quit [Ping timeout: 258 seconds]
nicholasf has quit [Ping timeout: 244 seconds]
nicholasf has joined #ocaml
MercurialAlchemi has joined #ocaml
adi___ has quit [Ping timeout: 258 seconds]
adi___ has joined #ocaml
A1977494 has joined #ocaml
pyon has quit [Ping timeout: 252 seconds]
<flux>
mrvn, no. resource management in GC finalizer leads to suffering.
<ggole>
Queue.iter and .fold take function arguments. If those functions result in another thread running, and that thread mutates the Queue.t being walked over, boom.
octachron has quit [Ping timeout: 252 seconds]
tane has joined #ocaml
ontologiae has joined #ocaml
copy` has joined #ocaml
sh0t has quit [Remote host closed the connection]
<moneybug>
Will the queue also fail if I mutate it during iteration without threads? What do threads add to the problem if there is a GIL and there are never 2 threads running at the same time?
<ggole>
Threads can wait on I/O without holding the lock.
<ggole>
Hmm, not sure about the first question.
<ggole>
I don't think it will crash, but you might lose some elements or something.
<moneybug>
In Java you can get a problem with references. E.g. you could have `let r = ref 0 in let i = incr ref in let t1 = Thread.create i () in let t2 = Thread.create i () in Thread.join t1; Thread.join t2; !r`
<moneybug>
That could give you `1` or `2`. But sounds like ocaml always gives `2`.
<moneybug>
That should be `let i () =`
<ggole>
Yeah, there are no data races
<ggole>
Threads will never execute at the same time
<ggole>
(At least, so far.)
<moneybug>
OK. Guess I won't worry too much about accidentally concurrently accessing the queue. As far as my tests show it's perfectly safe to have one thread push to a queue and another thread read off of it.
<ggole>
OK, although I would not expect there to be a cast-iron guarantee of that continuing to work.
<ggole>
I suppose you can introduce a mutex if multicore ocaml arrives and starts causing problems
MercurialAlchemi has quit [Ping timeout: 276 seconds]
<moneybug>
Where did you hear about multicore ocaml?
<ggole>
It's been kicking around for years at this point
<ggole>
And there was a presentation or two recently
myst|fon has quit [Quit: Connection closed for inactivity]
tautologico has quit [Ping timeout: 260 seconds]
jmasseo has joined #ocaml
ollehar has joined #ocaml
tautologico has joined #ocaml
moneybug has quit [Ping timeout: 264 seconds]
orbifx1 has joined #ocaml
moneybug has joined #ocaml
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
sdothum has joined #ocaml
orbifx1 has quit [Ping timeout: 264 seconds]
pyon has joined #ocaml
moneybug has left #ocaml ["Leaving"]
tautologico has quit [Ping timeout: 264 seconds]
rgrinberg has joined #ocaml
MercurialAlchemi has joined #ocaml
octachron has joined #ocaml
rgrinberg has quit [Quit: WeeChat 1.5]
rgrinberg has joined #ocaml
diphuser has quit [Ping timeout: 260 seconds]
shinnya has joined #ocaml
ontologiae has quit [Ping timeout: 244 seconds]
ontologiae has joined #ocaml
A1977494 has quit [Ping timeout: 240 seconds]
A1977494 has joined #ocaml
Algebr`` has joined #ocaml
ontologiae has quit [Ping timeout: 258 seconds]
ollehar has quit [Quit: ollehar]
jmiven has quit [Ping timeout: 240 seconds]
jmiven has joined #ocaml
tautologico has joined #ocaml
Simn has joined #ocaml
malc_ has joined #ocaml
tautologico has quit [Ping timeout: 244 seconds]
<gasche>
ggole: adding mutexes when all hell start breaking loose is a rather bad choice in my opinion, concurrent Thread-using code should already use mutexes to protect global shared resources
sh0t has joined #ocaml
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
<malc_>
gasche: what would be, in your opinion, best way to compile objective-c that has to interface ocaml? .m is not .c and as such ocaml (the driver) refuses to do anything.
sdothum has joined #ocaml
loocash has joined #ocaml
Submarine has quit [Ping timeout: 258 seconds]
unbalancedparen has joined #ocaml
AlexRussia has quit [Ping timeout: 258 seconds]
Submarine has joined #ocaml
<gasche>
malc_: I don't know anything about objective-C compilation, is it supposed to work as-is when passed to a C compiler?
<malc_>
gasche: yep
<gasche>
just Clang, or does it also work with gcc?
<malc_>
gasche: the main and only issue is suffix .m vs .c
<gasche>
(or is there still a preprocessing phase that turns it into plain C?)
<malc_>
gasche: there's no preprocessing
<malc_>
gasche: both(gcc/clang) have a functioning obj-c backends
<malc_>
gasche: in fact renaming file to .c and passing -x objective-c works
<malc_>
but, uhm...
<gasche>
I know of no easy option when invoking "ocamlc" directly
<gasche>
we have an -intf-suffix to change the ".mli" convention, but I know of no such thing for .ml or .c; this could be a reasonable feature request
<gasche>
if you are writing a build system rule, renaming is fine
<gasche>
but it should also be easy to invoke a C compiler directly instead of the ocamlc driver, which is just a convenience
<malc_>
gasche: not really, no. it can pass -m32/64 it can pass whatever is needed
<malc_>
knowledge that is not made pubic
<malc_>
hence my predicament
<gasche>
hm
<gasche>
one thing is that you can pass .o/.a files to have the driver do the linking after copmilatoin
<gasche>
so you don't need to reinvent the linking part
diphuser has joined #ocaml
<malc_>
having -as-c would work, having some variation on ocaml[c|opt] -where would work to
<gasche>
now the question is "how to emulate the compilation behavior of ocamlc on ocamlc?"
<gasche>
indeed having a kind of "ocamlc -cflags" would work as well
<gasche>
it seems to only use whatever configured decided as "the C compiler", pass (-I <standard library path>), and pass user-provided -cc* arguments
loocash has quit [Quit: Leaving]
<malc_>
-fno-strict-aliasing ... sigh
<malc_>
-fwrapv ouch
<malc_>
oh well
<malc_>
weird that PIC is used for byte but not native code...
<justin_smith>
is that because byte code is loaded into toplevels, but native code is statically compiled with the binary?
madroach has quit [Ping timeout: 244 seconds]
rgrinberg has quit [Ping timeout: 244 seconds]
<malc_>
justin_smith: `git log -p --grep=PIC` inside ocaml checkout can give some hints
<Algebr``>
malc_: I've done a lot of objc with ocaml
<Algebr``>
cc -c -o main_osx.o main_osx.m main_osx.m:10:10: fatal error: 'caml/mlvalues.h' file not found #include <caml/mlvalues.h> ^ 1 error generated.
<malc_>
Algebr``: I'm innocent, notice the nojb part of the repo uri
<Algebr``>
i see
<Algebr``>
ah, I could fix it later...
<malc_>
(FWIW it seems to build here on two different osx installations).. hmmm
rgrinberg has joined #ocaml
<Algebr``>
the makefile has some things that could be easy wins
<malc_>
Algebr``: such as?
<Algebr``>
doing foo := $(shell ) instead of plain =
<Algebr``>
:= will do it once
<Algebr``>
= will do it each time foo is used...pretty sure this is the case.
<malc_>
Algebr``: yeah sure
<malc_>
only those are used once, so not much of a win (currently)
tautologico has quit [Ping timeout: 258 seconds]
dhil has quit [Ping timeout: 250 seconds]
mattrepl has joined #ocaml
orbifx1 has quit [Ping timeout: 244 seconds]
unbalancedparen has quit [Ping timeout: 258 seconds]
<gasche>
malc_, justin_smith: -fPIC gives a slight degradation in code quality, so it is not the default for the native compiler
diphuser has quit [Remote host closed the connection]
diphuser has joined #ocaml
<gasche>
(I don't remember those low-level details but iirc. it forces to turn some known-offset jumps into slightly slower jumps)
unbalancedparen has joined #ocaml
<malc_>
gasche: that's mostly a 32bit thing, then again...
<gasche>
also, I believe that the compiler options are the one used to build the OCaml runtime itself
<gasche>
the reason it disables some of these optimizations is that the runtimes relies on behaviors that would be undefined without these flags
<malc_>
gasche: FILE_OFFSET_BITS changes quite a few things
<gasche>
I'm not sure why these optimizations would be passed to user code compiled through ocamlc, maybe the idea is that ocaml-FFI code will use typically the same kind of patterns
<gasche>
(eg. assumptions on the low bits of adresses cast as integers)
<malc_>
and fwrapv and stirct aliasing options can make quite a difference in the preprocessing hackery around CAMLvalue etc
<Algebr``>
okay this is super freaking weird to me. I have a type error because an unlabeled variable name happens to have the same name as a object type
<malc_>
gasche: justin_smith's assertion about loading stuff into top-level seems correct
<Algebr``>
the function is: fun ?(key="") this event ->
<Algebr``>
and there happens to also be a this object type defined
<gasche>
reproducible code?
<Algebr``>
yes, can commit and share
<gasche>
malc_: indeed, code for toplevel needs to be -fPIC iirc.
<gasche>
but note that there is also a native toplevel
<gasche>
and you can get a native build of OCaml with -fPIC; the question is more of why this choice of default
<Algebr``>
gasche: were you saying reproducible to me?
<gasche>
I mean that it's hard to help you / test / be convinced without a code example
<gasche>
(and if that really is the problem you say then a two-line snippet should suffice)
<gasche>
malc_: what is FILE_OFFSETS_BITS? something about the size of some C type?
<Algebr``>
gasche: will try to condense to essense of problem
<malc_>
gasche: info libc i feaure test macros describes FILE_OFFSET_BITS in some detail
<justin_smith>
malc_: it was more of a guess rather than assertion, to be fair
kakadu has joined #ocaml
<malc_>
justin_smith: it is certainly a valid one from where i stand (esp. on x86/32 and SysV ABI)