flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.0 out now! Get yours from http://caml.inria.fr/ocaml/release.html
alexyk has quit []
jeddhaberstro has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
slash_ has quit [Client Quit]
Dylan168071 has joined #ocaml
jm has joined #ocaml
julm has quit [Read error: 110 (Connection timed out)]
alexyk has joined #ocaml
Dylan16807 has quit [Read error: 110 (Connection timed out)]
travisbrady has quit []
ched_ has quit [Read error: 60 (Operation timed out)]
ched_ has joined #ocaml
jm is now known as julm
thedonvaughn has joined #ocaml
thedonvaughn has left #ocaml []
m3ga has joined #ocaml
alexyk has quit []
EdSolo has joined #ocaml
hzzhang has joined #ocaml
alexyk has joined #ocaml
mlh has quit [Read error: 110 (Connection timed out)]
seafood has quit []
hzzhang has left #ocaml []
travisbrady has joined #ocaml
jamii has joined #ocaml
willb has quit [Read error: 60 (Operation timed out)]
EdSolo has quit []
jm has joined #ocaml
julm has quit [Read error: 110 (Connection timed out)]
jm is now known as julm
Lomono has joined #ocaml
ched_ has quit [Read error: 110 (Connection timed out)]
jeddhaberstro has quit []
jargonjustin has joined #ocaml
<jargonjustin> I'm having some trouble getting a recursive-decent parser using the stream parsing to build under ocamlbuild with 3.11.0. I understand there were some changes in this release? Is there a minimal, complete example anywhere that will Just Work?
<jargonjustin> Right now I just get syntax error on the line with my stream patterns.
hzzhang has joined #ocaml
hzzhang has quit ["暂离"]
jbjohns has joined #ocaml
ilb_30 has joined #ocaml
jm has joined #ocaml
ilb_30 has quit [Read error: 104 (Connection reset by peer)]
julm has quit [Read error: 110 (Connection timed out)]
jm is now known as julm
sporkmonger has quit []
Axioplase has joined #ocaml
Camarade_Tux has joined #ocaml
seafood has joined #ocaml
_zack has joined #ocaml
alexyk has quit []
schme has joined #ocaml
seafood has quit [Success]
Ched has joined #ocaml
jbjohns has quit ["ChatZilla 0.9.84 [Firefox 3.0.10/2009042316]"]
julm has quit [Read error: 110 (Connection timed out)]
julm has joined #ocaml
seafood has joined #ocaml
ched_ has joined #ocaml
Ched has quit [Read error: 110 (Connection timed out)]
julm has quit [Read error: 110 (Connection timed out)]
julm has joined #ocaml
Yoric[DT] has joined #ocaml
<Yoric[DT]> hi
rjack has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
ikaros has joined #ocaml
dejj has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
jargonjustin has quit []
jeanbon has joined #ocaml
pants2 has joined #ocaml
pants1 has quit [Read error: 110 (Connection timed out)]
komar_ has joined #ocaml
smimram has quit ["bli"]
thelema has quit [Read error: 110 (Connection timed out)]
schme has quit ["Lost terminal"]
schme has joined #ocaml
Alpounet has joined #ocaml
komar_ has quit [Remote closed the connection]
komar_ has joined #ocaml
jm has joined #ocaml
julm has quit [Read error: 110 (Connection timed out)]
pierre_m has joined #ocaml
komar__ has joined #ocaml
komar_ has quit [Success]
jm has quit [Read error: 110 (Connection timed out)]
jm has joined #ocaml
pierre_m has left #ocaml []
jm has quit [Read error: 110 (Connection timed out)]
jm has joined #ocaml
jm has quit [Read error: 110 (Connection timed out)]
jm has joined #ocaml
ikaros_ has joined #ocaml
komar__ has quit [Remote closed the connection]
komar__ has joined #ocaml
Alpounet has quit [Read error: 110 (Connection timed out)]
ikaros has quit [Read error: 113 (No route to host)]
jeanbon has quit [Remote closed the connection]
hzzhang has joined #ocaml
jm has quit [Read error: 60 (Operation timed out)]
jm has joined #ocaml
jeanbon has joined #ocaml
Israel has joined #ocaml
<mrvn> First time I had a stub with >5 args. Kind of sucks that limit.
itewsh has joined #ocaml
rjack has quit ["leaving"]
jm has quit [Read error: 110 (Connection timed out)]
jm has joined #ocaml
Yoric[DT] has joined #ocaml
komar_ has joined #ocaml
Israel has quit []
komar__ has quit [No route to host]
Israel has joined #ocaml
ergodick1 has joined #ocaml
ergodick1 has left #ocaml []
rjack has joined #ocaml
rjack has quit ["leaving"]
Associat0r has joined #ocaml
<kaustuv_> How difficult would writing a google wave (tm) clone be in Ocsigen?
jeanbon has quit [Read error: 110 (Connection timed out)]
<olegfink> kaustuv_: clone or peer?
<kaustuv_> I meant whatever is needed to speak the wave protocol and talk to other google wave systems. If the technical term is "clone", then that's what I meant.
<kaustuv_> Or "peer"
<olegfink> oh, that shouldn't be too difficult, once you're able to speak HTTP, XML and XMPP
<olegfink> (that's from my understanding of Wave)
<kaustuv_> Are there any Jabber clients written in OCaml?
ikaros_ is now known as ikaros
<Yoric[DT]> Speaking (and understanding) XML is a pain, though.
<Yoric[DT]> Well, not necessarily more in OCaml than in anything else, but it's a pain.
<olegfink> kaustuv_, at least it seems there are a few xmpp libraries. I don't know of their status though.
<olegfink> but I still think Wave is severely flawed in its design.
<kaustuv_> You mean that the protocol is too chatty if every keystroke is multicasted to every recipient of a wave?
<olegfink> and also because of the data representation
<olegfink> it's one thing if that keystroke gets transmitted as a single (utf-8 encoded) character
<olegfink> slightly other thing if that an xmpp stanza.
<olegfink> *that's
<kaustuv_> I think google can be forgiven for making a few utopian assumptions about the network because (a) most of the communication will normally happen in a company LAN, and (b) copper-based wires are on the way out anyway
<olegfink> yeah, typical wireless has so much more bandwidth...
<Camarade_Tux> and there is a jabbr library but you'd probably have to annoy Mike Lin : http://www.broad.mit.edu/~mlin/ (I couldn't find a link on his website for it)
<kaustuv_> Presumably there will intelligently degrade the amount of back and forth data for wireless
<mrvn> On the other hand firms are noticing that long urls cost them real money because they waste bandwidth.
<kaustuv_> That's because HTML doesn't have a let ... in construct
<kaustuv_> Unless that's what entities are
<mrvn> kaustuv_: that doesn't really help in GET http://server/path/file HTTP/1.1
Axioplase is now known as Axioplase__
itewsh has quit [Read error: 60 (Operation timed out)]
Associat0r has quit []
itewsh has joined #ocaml
hzzhang has quit ["暂离"]
Alpounet has joined #ocaml
_zack has quit ["Leaving."]
ztfw has joined #ocaml
ikaros has quit ["Leave the magic to Houdini"]
ikaros has joined #ocaml
ztfw has quit [Remote closed the connection]
jm has quit [Read error: 110 (Connection timed out)]
jm has joined #ocaml
ikaros has quit ["Leave the magic to Houdini"]
ikaros has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
AxleLonghorn has joined #ocaml
seafood has quit []
seafood has joined #ocaml
seafood has quit [Client Quit]
seafood has joined #ocaml
<mrvn> Why would http://paste.debian.net/37527/ randomly segfault after a while?
jm has quit [Read error: 60 (Operation timed out)]
jm has joined #ocaml
AxleLonghorn has left #ocaml []
BiDOrD has quit [Read error: 110 (Connection timed out)]
<flux> should'nt you be in blockingsection while doing a caml callback?-o
BiDOrD has joined #ocaml
<mrvn> flux: no, blocking section is when you are not in ocaml and will probably block. Some other thread can run in that time.
<mrvn> afaik
<flux> ..hmm..
<flux> well, it's been a while I've done that, and by libev bindings never worked properly anyway, so don't listen to me :)
<mrvn> leave_blocking_section();
<mrvn> /* Convert parameters from C to Caml */
<mrvn> res = callback(closure, argument);
<mrvn> /* Convert results from Caml to C */
<mrvn> enter_blocking_section();
<flux> maybe that's the problem with my bindings them, or I've plainly forgotten about that, thanks :)
seafood has quit []
<mrvn> Filesystem *fs = (Filesystem*)fuse_req_userdata(req);
<mrvn> printf(" fs = %p\n", fs);
<mrvn> printf(" fs->ops = %p\n", fs->ops);
<mrvn> The last line segfaults.
<mrvn> fs = 0x7ff08f860618
<mrvn> Works a few thousand times and then segfaults.
<gl> is it C?
<mrvn> gl: yes
<mrvn> /proc/pid/maps shows: 7f5ff6b7a000-7f5ff6b7b000 rw-p 7f5ff6b7a000 00:00 0
<mrvn> 7f5ff6c97000-7f5ff6cdd000 rw-p 7f5ff6c97000 00:00 0
<gl> anyway the code is not correct, at least because you have to cast 'fs' and 'fs->ops' to (void*)
<mrvn> gl: huh? %p prints any pointer.
<gl> no, %p is for void*
<mrvn> (void*)(other_pointer) is a nop on all sensible archs.
<mrvn> Someone frees the fs structure.
<mrvn> fs = 0x7f5ff6c94600 (as it is on this run) is just not allocated anymore.
<gl> well, you're talking about the convertion to asm, which is not C; the C standard explicitly says that %p is for void*, and there is no implicit conversion (is the standard) from any pointer to void*
<gl> s/is/in/
<gl> but it's a detail, i doubt that it's why your code segfaults
<mrvn> its debug output anyway, not the cause of the segfault. And gcc checks the printf format string and deams it correct.
<gl> okay
<gl> it's always this line which segfaults?
jeanbon has joined #ocaml
<mrvn> no
Israel has quit [Read error: 113 (No route to host)]
Israel has joined #ocaml
jm has quit [Read error: 110 (Connection timed out)]
jmou has joined #ocaml
<mrvn> args, every time I add some debug output to one of the stubs the code fails in a different one.
<gl> mrvn: ulimit -c unlimited && ./binary ; gcc ./binary core.number ?
<gl> without printf() code
<gl> i don't know how to debug c/ocaml binding, but if it's a C allocation problem, you may code a small wrapper for malloc()/free()/etc, to monitor in which functions the memory is allocated/freed, when, etc
<mrvn> valgrind says: ==31832== Invalid read of size 8
<mrvn> ==31832== at 0x430014: unlink_stub (in /home/mrvn/src/defragfs-ml/defragfs)
<mrvn> ==31832== Address 0x216231b02162363 is not stack'd, malloc'd or (recently) free'd
<gl> have to go; good evening
* gl &
_zack has joined #ocaml
<mrvn> # caml_fuse_read_stub(req = 0x66459a0) fs = 0x5f80618 fs->ops = 0x5f80360
Ched has joined #ocaml
<mrvn> # unlink_stub(req = 0x6645160) fs = 0x5f80618 fs->ops = 0x216231b0216231b
<mrvn> Something is corrupting the C structure.
<mrvn> # caml_fuse_read_stub(req = 0x66459a0) fs = 0x5f80618 fs->ops = 0x5f80360
<mrvn> ups
sporkmonger has joined #ocaml
Axioplase__ has quit ["leaving"]
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
ched_ has quit [Read error: 110 (Connection timed out)]
alexyk has joined #ocaml
<mrvn> My code segfaults right after the first time the GC shrinks the heap.
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
<mfp> mrvn: I don't think you can allocate and use the GC implicitly between leave_blocking_section and enter_blocking_section
<palomer> do you guys use listings to incorporate ocaml code into your latex documents?
<mrvn> mfp: that is specifically what leave_blocking_section is for
<mfp> two threads changing the minor heap pointer at once or running the GC at once -> boom
<mrvn> leave_blocking_section takes the global lock, enter_blocking_section frees it
<mrvn> leave enters ocaml land and enter leaves it.
<mfp> argh misread
<mrvn> they are quite misleading.
<mrvn> The problem must be somehow here:
<mrvn> // Register ml_ops as root
<mrvn> caml_register_global_root(&fs->ops);
<mrvn> fs->ops = ml_ops;
<mrvn> When the GC shrinks the minor heap it overwrites fs->ops with garbage.
<mfp> fs->ops is uninitialized before you register it as a root?
<mrvn> or rather, it unmaps the memory where fs is.
<mfp> if so, it'll definitely crash when the GC follows that pointer
<mrvn> Registration of a global variable v is achieved by calling caml_register_global_root(&v) just before a valid value is stored in v for the first time.
<mrvn> ^^^ from the docs. It is 0 before.
<mrvn> Args, I found the error:
<mrvn> ml_fs = caml_alloc_custom(&caml_fuse_filesystem_ops, sizeof(Filesystem), 0, 1);
<mrvn> Filesystem *fs = (Filesystem*)Data_custom_val(ml_fs);
<mrvn> That means the GC moves fs around.
<mrvn> fs has to be outside the ocaml heap.
jmou has quit [Read error: 60 (Operation timed out)]
<mfp> mrvn: having several threads doing CAMLparamX / CAMLreturn simultaneously isn't safe, is it?
<mrvn> mfp: good question.
jmou has joined #ocaml
<mfp> I assume the statfs_stub function you pasted is wrapped in a enter_blocking_section / leave_blocking_section, right?
<mfp> otherwise, there's only going to be 1 thread running that code, anyway (so no additional leave_... / enter_... needed)
<mrvn> mfp: yes. So the CAMLparam0() should be after leave_blocking_section();?
<mrvn> How am I supposed to do this? I can't have CAMLreturn0 before enter_blocking_section
<mfp> just checked > these macros operate on the caml_local_roots global, so not doing so is guaranteed to cause problems
komar__ has joined #ocaml
<mrvn> so I need a mini_stub() { leave_blocking_section(); real_stub(); enter_blocking_section(); }?
<mfp> wrap it all, yeah
<mrvn> Urgs, I have like 20 of them.
<mfp> or remove the outer enter_blocking ... leave_blocking :P
<mrvn> mfp: can't do that when the c lib blocks.
<mfp> the idea is to wrap with enter_ ... only the blocking C parts, not your stubs
<mfp> cannot you isolate the blocking funcs from the C lib?
<mrvn> mfp: ocaml calls a C lib that then calls back.
komar_ has quit [No route to host]
<mfp> oh
<mrvn> Notice the caml_callback3(Field(fs->ops, RMDIR), ml_req, ml_parent, ml_name);
<mfp> uh? I only have http://paste.debian.net/37527/
<mrvn> caml_callback2(Field(fs->ops, STATFS), ml_req, ml_ino);
<mrvn> same thing.
<mfp> so you're giving statfs_stub as the callback func to some lib function?
<mrvn> mfp: yes
<mfp> looks like the only way is to wrap every func, then
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
komar_ has joined #ocaml
<mrvn> Luckily so far everything is single threaded
<mrvn> Ok, made fs outside the ocaml heap. New test running.
<mrvn> 1243707023 write: 0 GiB, 2.029729 MiB/s [2.029729 MiB/s] read: 0 GiB, 1.626873 MiB/s [1.626873 MiB/s] # Sat May 30 20:10:23 2009
itewsh has quit [Read error: 60 (Operation timed out)]
<Camarade_Tux> not too bad
<mrvn> 1243707084 write: 0 GiB, 1.743828 MiB/s [1.457928 MiB/s] read: 0 GiB, 1.589612 MiB/s [1.552350 MiB/s] # Sat May 30 20:11:24 2009
<mrvn> seems to work.
itewsh has joined #ocaml
<mrvn> Now I have to remove all the debug printf() again.
<flux> soo, what was the problem and the solution?
<mrvn> ml_fs was a custom block containing the struct Filesystem. The GC moved the block while the C library had the address to the struct Filesystem. Now the custom block only contains a pointer to struct Filesystem which is simply malloc()ed.
Amorphous has quit [Read error: 110 (Connection timed out)]
<flux> right.
<mrvn> Initialy I didn't have the C lib keep a pointer to struct Filesystem but had it as a global variable. Forgot to change the code when I passed the address to the lib for save keeping.
Amorphous has joined #ocaml
komar__ has quit [Read error: 110 (Connection timed out)]
sporkmonger has quit ["Poof!"]
<mrvn> 4860 mrvn 0 59144 3132 S 32.9 0.3 7:36.15 xterm
<mrvn> 4661 root 0 284m 47m S 12.0 4.7 5:26.19 Xorg
<mrvn> 12735 root 0 21784 4776 D 34.9 0.5 0:47.54 defragfs
<mrvn> 12743 mrvn 0 5780 2728 S 3.7 0.3 0:07.34 fstest
<mrvn> Still way too much debug output.
<mrvn> 1243707841 write: 0 GiB, 4.669185 MiB/s [4.669185 MiB/s] read: 0 GiB, 4.239194 MiB/s [4.239194 MiB/s] # Sat May 30 20:24:01 2009
<mrvn> and still too slow to use.
komar__ has joined #ocaml
komar_ has quit [Read error: 113 (No route to host)]
ched_ has joined #ocaml
Ched has quit [Read error: 110 (Connection timed out)]
jmou has quit [Read error: 110 (Connection timed out)]
jmou has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
komar__ is now known as komar_
sporkmonger has joined #ocaml
jmou has quit [Read error: 60 (Operation timed out)]
jmou has joined #ocaml
dejj has quit ["Leaving..."]
<palomer> do you guys prefer lstlistings or verbatim?
jeddhaberstro has joined #ocaml
<flux> lstlistings
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
sporkmonger has quit []
sporkmonger has joined #ocaml
schme has quit [Read error: 110 (Connection timed out)]
Lomono has quit ["Don't even think about saying Candlejack or else you wi"]
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
Lomono has joined #ocaml
sporkmonger_ has joined #ocaml
sporkmonger_ has quit [Remote closed the connection]
smimou has joined #ocaml
alexyk has quit []
sporkmonger has quit [Read error: 113 (No route to host)]
pants2 has quit [Read error: 110 (Connection timed out)]
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
komar_ has quit [Read error: 113 (No route to host)]
alexyk has joined #ocaml
slash_ has joined #ocaml
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
komar_ has joined #ocaml
Lomono has quit ["Don't even think about saying Candlejack or else you wi"]
AxleLonghorn has joined #ocaml
Camarade_Tux has quit [Read error: 110 (Connection timed out)]
smimou has quit [Remote closed the connection]
alexyk has quit []
ikaros has quit ["Leave the magic to Houdini"]
itewsh has quit [Success]
itewsh has joined #ocaml
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
ched_ has quit [Remote closed the connection]
Ched has joined #ocaml
jeanbon has quit ["EOF"]
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
Associat0r has joined #ocaml
Associat0r has quit [Read error: 104 (Connection reset by peer)]
_zack has quit [Remote closed the connection]
_zack has joined #ocaml
bebui has quit [Read error: 113 (No route to host)]
itewsh has quit [Remote closed the connection]
ikaros has joined #ocaml
AxleLonghorn has left #ocaml []
_zack has quit ["Leaving."]
slash_ has quit [Client Quit]
psnively has joined #ocaml
Yoric[DT] has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
seafood has joined #ocaml
Alpounet has quit ["Quitte"]
jmou has quit [Read error: 110 (Connection timed out)]
jmou has joined #ocaml