jemc changed the topic of #ponylang to: Welcome! Please check out our Code of Conduct => https://github.com/ponylang/ponyc/blob/master/CODE_OF_CONDUCT.md | Public IRC logs are available => http://irclog.whitequark.org/ponylang | Please consider participating in our mailing lists => https://pony.groups.io/g/pony
atk has quit [Quit: Well this is unexpected.]
atk has joined #ponylang
Candle has joined #ponylang
Candle has quit [Ping timeout: 240 seconds]
chemist69 has quit [Disconnected by services]
chemist69_ has joined #ponylang
Candle has joined #ponylang
smoon has joined #ponylang
Candle has quit [Ping timeout: 240 seconds]
pduncan has joined #ponylang
Candle has joined #ponylang
chemist69_ has quit [Ping timeout: 264 seconds]
Candle has quit [Ping timeout: 240 seconds]
Candle has joined #ponylang
chemist69 has joined #ponylang
Candle has quit [Ping timeout: 240 seconds]
Candle has joined #ponylang
Candle has quit [Ping timeout: 240 seconds]
smoon has quit [Quit: smoon]
smoon has joined #ponylang
Candle has joined #ponylang
gmcabrita has quit [Quit: Connection closed for inactivity]
jemc has joined #ponylang
flutter8 has quit [Ping timeout: 240 seconds]
jemc has quit [Ping timeout: 258 seconds]
<FunkyBob> anyone awake? I'm trying to write a simple HTTP server, and getting a bit lost :/
smoon has quit [Quit: smoon]
pduncan has quit [Ping timeout: 255 seconds]
chemist69 has quit [Ping timeout: 240 seconds]
<endformationage> Hey FunkyBob
<FunkyBob> hi
chemist69 has joined #ponylang
<FunkyBob> seems like a very deep dive to set it up, endformationage :)
<endformationage> The HTTPServer?
<endformationage> I guess a simple server example in the examples section of the repo would be cool. I found the client example to be helpful
<endformationage> FunkyBob: Where are you getting hung up?
<FunkyBob> just seem to be so many parts I need to implement
<FunkyBob> hang about, $DAY_JOB intrudes :P
<endformationage> Bleh, I meant hung up on with server :D
<FunkyBob> yah
<endformationage> At least you can see usage of HTTPHandler in the get example: https://github.com/ponylang/ponyc/blob/master/examples/httpget/httpget.pony
<endformationage> Perhaps there's an server example elsewhere.
<FunkyBob> I think I need TCPConnection and TCPConnectionNotify to do server.register_session on connect
<endformationage> BTW, whoever made the playground, I am finding it very useful!
<FunkyBob> link?
<endformationage> It's great to quickly test simple ideas, get rcaps worked out..
<endformationage> Hmm. It looks like th eplayground is broken.
<endformationage> After attempted Run: mktemp: failed to create directory via template '/tmp/tmp.XXXXXXXXXX': No space left on device
<endformationage> :/
<endformationage> Yep. It ran out of space.
<FunkyBob> erk
* endformationage sits outside playground fence until equipment is fixed.
<endformationage> FunkyBob: RE: the TCPConnection, I think you're right.
<endformationage> And then unregister after you're done handling the request I guess.
chatter29 has joined #ponylang
chatter29 has quit [Client Quit]
chatter29 has joined #ponylang
<chatter29> hey guys
<chatter29> allah is doing
<chatter29> sun is not doing allah is doing
<chatter29> to accept Islam say that i bear witness that there is no deity worthy of worship except Allah and Muhammad peace be upon him is his slave and messenger
<FunkyBob> peace be upon you ,too, but I feel this is all off topic.
chatter29 has quit [Client Quit]
chatter29 has joined #ponylang
chatter29 has quit [Client Quit]
<endformationage> SeanTAllen: FYI, playground is broken.
<endformationage> Perhaps it will come back upgraded to 0.140.
<FunkyBob> heh
<doublec> FunkyBob: still need help?
Candle has quit [*.net *.split]
atk has quit [*.net *.split]
papey_lap has quit [*.net *.split]
Candle has joined #ponylang
papey_lap has joined #ponylang
<FunkyBob> doublec: yep
<FunkyBob> btw is there a nice pattern for "read chunks from this file until we're done"?
atk has joined #ponylang
<FunkyBob> doublec: this is my bogus code so far -- https://dpaste.de/Wjgt
<FunkyBob> I guess it's easier to just let it call back for more data
<doublec> Looks like http server has changed a lot since I last used it
<FunkyBob> this mentions send_body
<FunkyBob> but I can't find what has it
<FunkyBob> oh, that's for client
<doublec> the main problem with the way you're doing the file reading/writing is it'll block the actor it's running on until the entire file is sent
<FunkyBob> or ... maybe not
<FunkyBob> doublec: yeah, am looking to do callback based reads
<FunkyBob> but can't find all the right hooks
<doublec> An approach is to create an actor to do it, where the behaviour recursively calls itself with chunks of the file
<FunkyBob> but
<doublec> So boltedHandler.apply would create an actor that owns payload, and that actor has a behaviour that reads from the file
<FunkyBob> there's hints in the help text that it's possible to have it call you back for each chunk
<FunkyBob> stream transfer mode
<doublec> Ah ok
<doublec> FunkyBob: have you read the RFC where the changes to add that functionality were made?
<FunkyBob> _client_connection.pony: The `HTTPHandler.send_body` notification function will be called if/when
<FunkyBob> found it
<FunkyBob> well, fuck
<FunkyBob> doublec: no, I haven't
<FunkyBob> read the RFC
<FunkyBob> ah -- Is it possible to maintain the existing pull interface as a layer on top of the new push interface?
<doublec> I have no idea sorry, I've not used it at all
<FunkyBob> thanks
<FunkyBob> wonder if this still works
abbiya has joined #ponylang
<FunkyBob> yes, it does... well
Candle has quit [Ping timeout: 240 seconds]
Candle has joined #ponylang
endformationage has quit [Quit: WeeChat 1.7]
<FunkyBob> ok, compile won't work as it says something can raise an exception
<doublec> Something needs a try...end block, or have the function marked as partial.
<FunkyBob> yeah, am trying to work out what
<FunkyBob> the stdlib docs aren't mentioning anything I can see
<doublec> FunkyBob: the join method?
<doublec> Or File.open
<FunkyBob> yay, it compiles
<FunkyBob> ok, I got a 405... but otherwise
<FunkyBob> ok, it's getting somewhere now
<FunkyBob> some someone tell me how I pass flags to FilePath.join ?
<FunkyBob> oh
<FunkyBob> grr
gmcabrita has joined #ponylang
<FunkyBob> yay, it's working!
gmcabrita has quit []
gmcabrita has joined #ponylang
SeanTAllen has quit []
SeanTAllen has joined #ponylang
flutter30 has joined #ponylang
grim_ has joined #ponylang
papey_lap has quit [Quit: WeeChat 1.7.1]
TheLemonMan has joined #ponylang
<SeanTAllen> Thanks for the note about Pony Playground. I pinged Paul who runs it.
<FunkyBob> SeanTAllen: not sure if you saw my earlier adventures...
<FunkyBob> I wrote a simple static http server...
<FunkyBob> will benchmark it, then try to weave an actor into it for parallelism
<FunkyBob> however...
<FunkyBob> apparently it used be possible to have a callback request more chunks of content... I can't see how to do anything like that now
cquinn has quit []
cquinn has joined #ponylang
_andre has joined #ponylang
<SeanTAllen> Pony Playground fixed
<SeanTAllen> ive never used the http server so i'm not sure about that FunkyBob
<SeanTAllen> the first "http server" was a simple proof of concept that was rewritten and the new server was submitted by a community member
<FunkyBob> hmm
<FunkyBob> well, I have tihngs working, and I'm creating an Actor, now, for each response
<FunkyBob> but unless File is wrapping up an actor somewhere,....
<FunkyBob> I can't see where the actor might yield to another actor
<FunkyBob> I guess since it's palmed off to an actor, at least it can handle another request
abbiya has quit [Remote host closed the connection]
<FunkyBob> am hitting it with siege... it's using 200+ % CPU :)
<FunkyBob> Transaction rate: 3638.44 trans/sec
<FunkyBob> ok, something's not right
<FunkyBob> second run never got any answers
<FunkyBob> I tried making my HTTPHandler an actor, but couldn't get the permissions right somewhere
<FunkyBob> s/perms/rcaps/
<FunkyBob> ok, I'm getting lost here
<FunkyBob> later, people
malthe is now known as malthe|away
aav has joined #ponylang
jemc has joined #ponylang
jemc has quit [Ping timeout: 258 seconds]
jemc has joined #ponylang
IdkPony has joined #ponylang
<IdkPony> Is there a guide/tutorial about working with async I/O in pony somewhere? Or any code examples that might explain how Async I/O works in Pony?
pduncan has joined #ponylang
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
irx[m] has quit [Ping timeout: 252 seconds]
<SeanTAllen> IdkPony: the tutorial contains a section on behaviors. all actor to actor calls in Pony are done via behaviors which are async.
<SeanTAllen> o
<SeanTAllen> async I/O
<SeanTAllen> when you say "async i/o" IdkPony, are you referring to network IO? File? Something else?
<SeanTAllen> or perhaps you mean how Pony works with KQueue, Epoll et al?
irx[m] has joined #ponylang
flutter30 has quit [Ping timeout: 268 seconds]
IdkPony has quit [Ping timeout: 260 seconds]
flutter38 has joined #ponylang
M-hrjet has quit [Remote host closed the connection]
buchanon[m] has quit [Remote host closed the connection]
srenatus[m]1 has quit [Read error: Connection reset by peer]
graaff has joined #ponylang
irx[m] has quit [Ping timeout: 252 seconds]
irx[m] has joined #ponylang
amclain has joined #ponylang
srenatus[m] has joined #ponylang
M-hrjet has joined #ponylang
buchanon[m] has joined #ponylang
endformationage has joined #ponylang
papey_lap has joined #ponylang
papey_lap has quit [Client Quit]
flutter38 has quit [Ping timeout: 272 seconds]
flutter11 has joined #ponylang
papey_lap has joined #ponylang
Matthias247 has joined #ponylang
plietar has joined #ponylang
graaff has quit [Ping timeout: 272 seconds]
graaff has joined #ponylang
TheLemonMan has joined #ponylang
IdkPony has joined #ponylang
<IdkPony> SeanTAllen, Specifically File I/O at the moment, however I want to look into network later. I'm not looking for how it works with kqueue, epoll or iocpm
<IdkPony> I'll have a look at behaviors. A code example of how a async file I/O is done would be interesting to look at for example.
<jemc> IdkPony: I think the `files` package in the standard library currently only implements synchronous I/O - network I/O is all asynchronous in Pony, but we're currently missing the files API to match, in part because synchronous file I/O doesn't pose a lot of the same problems as synchronous network I/O, so nobody has scratched that particular itch yet
kempe has quit [Remote host closed the connection]
kempe has joined #ponylang
graaff has quit [Quit: Leaving]
jmiven has quit [Quit: WeeChat 1.7.1]
jmiven has joined #ponylang
_andre has quit [Quit: leaving]
IdkPony has quit [Ping timeout: 260 seconds]
papey_lap has quit [Ping timeout: 272 seconds]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<SeanTAllen> idkPony: anything in particular you are looking to do with async file I/O?
flutter11 has quit [Read error: Connection reset by peer]
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar_ has joined #ponylang
plietar has quit [Ping timeout: 264 seconds]
plietar_ has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
plietar has joined #ponylang
<FunkyBob> morning, all
<jemc> hello!
<FunkyBob> how's things, jem?
<FunkyBob> so yesterday I managed a "simple" static web server, and am now working to make it scale :)
<FunkyBob> but I'm sure I've something wrong, as whilst the first benchmark works fine, subsequent ones can't connect
<FunkyBob> Transaction rate: 4883.72 trans/sec
grim_ has quit [Read error: Connection reset by peer]
<FunkyBob> ok, that's clearly WIP code :)
<FunkyBob> ok... how do I 'terminate' an actor?
<FunkyBob> I appear to have 6GB of actors hanging about
Matthias247 has quit [Read error: Connection reset by peer]
<FunkyBob> jemc: no ideas?
<jemc> sorry, in the middle of dealing with some stuff at my day job
<jemc> in general, non-I/O actors should be automatically freed when they finish, as long as no one is holding onto a reference to them
<jemc> which, from a brief look, seems to be true of your application at first glance
<FunkyBob> sure thing
<doublec> FunkyBob: the 'send_file' behaviour sends the entire contents of the file inside a loop
<doublec> FunkyBob: No GC occurs while this happens
<FunkyBob> yep
<doublec> FunkyBob: so the entire file is held in memory
<FunkyBob> I can't find how to not do that
<doublec> FunkyBob: multiple times
<FunkyBob> the API doesn't seem to permit otherwise
<doublec> FunkyBob: ie. in the chunks, in the src.read buffers, etc
<FunkyBob> yes, but shouldn't that all be freed when the actor expires?
<doublec> FunkyBob: I'll do some psuedocode
<doublec> FunkyBob: when the behaviour completes it does
<doublec> FunkyBob: How are you mesasuring the total memory used by the program?
<FunkyBob> htop
<FunkyBob> on start, rss of 3980
<doublec> FunkyBob: something like https://pastebin.com/c88ZQK7p
<doublec> FunkyBob: (untested)
<FunkyBob> curiously, I'e stopped siege, but the task is still using 100% cpu
<FunkyBob> ah, I see
<jemc> FunkyBob: it's probably working through a big backlog of requestss to process
<jemc> (unaware that the other end of the pipe has already been closed)
<doublec> I wonder if the http code is holding onto the sessions
<doublec> Or it could be the sessions in flight as jemc said
<jemc> TwoNotes recently did a major refactor of the http code, so I'm not very familiar with the current implementation
<doublec> remember each one of those will have multiple copies of the file in memory
<FunkyBob> multiple?
<doublec> During send_file there is the data read by 'read' during the loop which becomes the complete file contents
<doublec> That's one copy. Then there is the response.add_chunk. That's another copy.
<FunkyBob> ah, ok
<doublec> (possibly - I'm not sure how it's implemented underneath)
<doublec> None of that gets GC'd until the behaviour ends
<doublec> Or until the behaviour calls another behaviour
<doublec> Maybe some of those internal calls are behaviour calls
<FunkyBob> psst... if/then not if/do :)
<doublec> :)
<doublec> I use too many different languages haha
<FunkyBob> ah, fuck, I'm into rcaps hell now :/
<FunkyBob> /home/curtis/src/bolted/main.pony:38:20: this parameter must be sendable (iso, val or tag) be sender(file : File, response : Payload) =>
<FunkyBob> /home/curtis/src/bolted/main.pony:31:17: File ref is not a subtype of File val: ref is not a subcap of val
<FunkyBob> i really need to print a type hierarchy chart
<doublec> Ah yeah, that's a pain
<doublec> Need file to be an iso
<doublec> And consume it when passing to 'sender'
<jemc> val should also work if you just need to read from it
<FunkyBob> /home/curtis/src/bolted/main.pony:31:17: File ref is not a subtype of File iso: ref is not a subcap of iso
<jemc> either way, you'll want to put the `OpenFile` in a `recover <cap> ... end` block
<FunkyBob> ah
<FunkyBob> umm
<FunkyBob> that made no difference... odd
<FunkyBob> match recover val OpenFile(full_path) end
<FunkyBob> ah well... time to focus on $DAY_JOB
<FunkyBob> thanks all
<doublec> np