ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.2 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <fridgerator> @faustinoaq wow!
greengriminal has quit [Quit: This computer has gone to sleep]
hightower2 has joined #crystal-lang
hightower3 has quit [Ping timeout: 268 seconds]
greengriminal has joined #crystal-lang
greengriminal has quit [Ping timeout: 256 seconds]
greengriminal has joined #crystal-lang
<FromGitter> <girng> oh gitter updated their homepage
<FromGitter> <girng> https://i.gyazo.com/5ae34d77e1d9d3c5c8f04161f4df636c.png /root/test is my crystal app. i loaded up a bunch of tcp connections and closed them. but my memory is still high what do i do?
greengriminal has quit [Quit: This computer has gone to sleep]
faustinoaq has quit [Ping timeout: 256 seconds]
faustinoaq has joined #crystal-lang
notdaniel has joined #crystal-lang
notdaniel has quit [Client Quit]
faustinoaq has quit [Read error: Connection reset by peer]
faustinoaq has joined #crystal-lang
notdaniel has joined #crystal-lang
notdaniel has quit [Remote host closed the connection]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 264 seconds]
Raimondii is now known as Raimondi
<FromGitter> <r00ster91> I upgraded my WSL to Ubuntu 18.04 now. So I wanted to reinstall Crystal. But somehow the commands on https://crystal-lang.org/docs/installation/on_bash_on_ubuntu_on_windows.html don't work. When I execute `curl -sSL https://dist.crystal-lang.org/apt/setup.sh | sudo bash` then I get https://hastebin.com/ujojuhodad.sql.
<FromGitter> <r00ster91> Should I create an issue on GitHub?
<oprypin> let me try it
<oprypin> ayy it spews errors all over the place
<oprypin> on second thought, maybe let's try `vagrant init ubuntu/bionic64 && vagrant up`
<FromGitter> <r00ster91> it wants to install around 150 packages when i want to install `vagrant`
<oprypin> r00ster91, don't do that, that's for me
<FromGitter> <r00ster91> oh
<oprypin> works for me
<oprypin> r00ster91, maybe your system is misconfigured. a fresh ubuntu works. https://bpaste.net/show/be25f15ad1da
<oprypin> (vagrant is just a way to get a fresh ubuntu vm, dont mind that)
<FromGitter> <r00ster91> I didnt really configured anything myself. I just installed this ubuntu 18.04 from the windows store. There are also the other distributions like kali linux. And on kali linux I got an similar error
<oprypin> dont use kali linux lol
<oprypin> r00ster91, is your system time correct?
<FromGitter> <r00ster91> yes im pretty sure
<FromGitter> <r00ster91> hmm maybe i should try debian distribution. But its weird that 18.04 ubuntu doesnt works but the old ubuntu does
<oprypin> r00ster91, i literally just showed you that it works
<FromGitter> <r00ster91> i mean it doesnt works at me
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 240 seconds]
faustinoaq has quit [Ping timeout: 248 seconds]
<oprypin> girng, omg dont you remember that GC does not release memory from the previous thread you made
<oprypin> well there is no such thread, must have been something else
<FromGitter> <girng> but, in nodejs they got gc, and memory didn't go up. so i was thnking maybe i did my server.cr wrong (leak)
<FromGitter> <girng> i originally thought it was because of all the Game classes i was creating (when @faustinoaq was helping me), so i reduced my example into just 1 class (GameServer) hopefully that helps
<oprypin> we have been through this
<FromGitter> <girng> something isn't right though, cuz i can create 360,000 class instances in a loop and memory usage stays the same
<FromGitter> <girng> but when new sockets are connecting and closing, memory keeps going up n up
ua has joined #crystal-lang
<oprypin> for one, you never close any socket
ua_ has quit [Ping timeout: 256 seconds]
<FromGitter> <girng> inside rescue, should i try it with socket.close ?
<FromGitter> <girng> let me try that 1sec
<oprypin> why inside rescue
<oprypin> you say "new sockets are connecting and closing" but dont actually close sockets
<FromGitter> <girng> because the exception gets called...
<FromGitter> <girng> when there is no connection in the server
<FromGitter> <girng> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b0156a452194a4a67fca209]
<FromGitter> <girng> like this?
<oprypin> no
<FromGitter> <girng> ok well iunow hat u mean "never close any socket" lol
<FromGitter> <girng> if i CLOSE my socket.cr, doesn't all the connections drop automatically??
<FromGitter> <girng> are you talking about server.cr or socket.cr
<oprypin> look dude.. you spawn 900 connections that run an infinite loop and never close them
<oprypin> how can you claim they're closing?
<FromGitter> <girng> because i'm benchmarking the server, why would i close them??
<FromGitter> <girng> if i want to close them, i just do ctrl+c and socket.cr stops running
<FromGitter> <girng> which drops all the connections
<FromGitter> <girng> then i re-do it again, and again
<FromGitter> <girng> i'm simulating players connecting to a game server
<FromGitter> <girng> and how it effects the server...
<oprypin> it does not drop all the connections
<oprypin> or any connections at all
<oprypin> they're just left there hanging awkwardly
<FromGitter> <girng> how can they be there when socket.cr isn't running though?
<oprypin> sockets, how do they work?
<FromGitter> <girng> well,from what i'm understanding they are bidirectional for TCP
<FromGitter> <girng> so if the other end fails, it should close it
<FromGitter> <girng> how can any socket be active, when socket.cr isn't running is my question
<oprypin> the other end does not know why data suddently stopped coming
<FromGitter> <girng> i thought that's UDP?
<oprypin> the default is to wait like 180 seconds and maybe the data will come again, who knows, maybe they just have bad internet lol
<FromGitter> <girng> yah, wtf
<FromGitter> <girng> i run `netstat -ntu`, got all established even when i close my socket.cr
<FromGitter> <girng> possible to catch a ctrl+c command in terminal to run some code before it closes?
<oprypin> think about malicious clients
<crystal-gh> [crystal] RX14 closed pull request #6108: Add macro verbatim blocks (master...feature/macro-raw) https://git.io/vphZ8
<FromGitter> <girng> well, i need to close from the server then?
<oprypin> socket closing on the other side is not reliably detectable anyway
<oprypin> you can decrease tcp timeout
<oprypin> and of course clients should indeed close gracefully
<FromGitter> <girng> the thing is..
<oprypin> it's not like closing a client with ctrl+c will be normal for the full product
<FromGitter> <girng> rescue e gets called 900 times, if i do ctrl+c on my socket.cr
<FromGitter> <girng> so... server knows it's closing...
<oprypin> that's possible
<FromGitter> <girng> well, ic an't adjust the timout of 7200 seconds
<FromGitter> <girng> on this shtty OPENVZ VPS
<oprypin> i think you can
<oprypin> heh 180 is what I set it to, actually
<oprypin> the real timeout is obscenely long
<FromGitter> <girng> eh. that's socket (clientside). i mean for the debian OS
<FromGitter> <girng> IIRC need KVM or Zen or something to modify the tcp keepalive timeout setting. default is 7200 seconds which is beyond stupid
<oprypin> or pay twice more for an actual vps
<FromGitter> <petoem> does someone know how i can get the current arch string e.g. "x86_64" in a macro?
<oprypin> possibly cant
<FromGitter> <bararchy> RX14 any idea when is the next stream of parallel.cr ?
<FromGitter> <bararchy> ;)
<RX14> after my exams lol
<FromGitter> <bararchy> XD good luck 👍
straight-shoota has joined #crystal-lang
<FromGitter> <petoem> then i will have to use `{% if flag?(:x86_64) %}`
<FromGitter> <girng> i added `server.write_timeout = 2`,now memory doesn't go up n up
<FromGitter> <girng> fixed!
<FromGitter> <girng> ..and that was from oprypins critter repo,w here i found it, thanks man
<travis-ci> crystal-lang/crystal#06e763b (master - Add macro verbatim blocks (#6108)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/381300183
<DeBot> https://github.com/crystal-lang/crystal/pull/6108 (Add macro verbatim blocks)
straight-shoota has quit [Quit: Quit]
rohitpaulk has joined #crystal-lang
<FromGitter> <bararchy> Dosn't it make more sense in your case to use MQ?
greengriminal has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
Philpax has quit [Ping timeout: 256 seconds]
greengriminal has joined #crystal-lang
duane has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.1]
<FromGitter> <girng> yeah i give up
<FromGitter> <girng> TCPServer doesn't close connections
<oprypin> here's my output https://bpaste.net/show/4b74dcaedc59
<oprypin> i cant grasp why it suddenly interrupts
<oprypin> even so, this modded compiler is able to compiple programs just fine but not print the output for whatever reason
alex`` has joined #crystal-lang
duane has quit [Ping timeout: 248 seconds]
<FromGitter> <MrSorcus> https://play.crystal-lang.org/#/r/43nn - why doesn't work? X-)
<FromGitter> <MrSorcus> https://gist.github.com/MrSorcus/d834416b59578587192356648634d373 - really? Doesn't work with IPv6? ........
<oprypin> MrSorcus, doesnt look like an ipv6 address at all
<Yxhuvud> oprypin: it looks like one of the ways to write a compacted version of an ipv6 address.
<oprypin> i dont think there's any syntax that allows writing ipv6 with no digits at all
<FromGitter> <MrSorcus> > *<oprypin>* @MrSorcus, doesnt look like an ipv6 address at all ⏎ ⏎ `Error: No address found for [2a01:4f8:a0:438a:2eea:xx:xx:xxdf]:8080 over TCP` - this too?
<FromGitter> <Val> @MrSorcus try `::1`
<FromGitter> <Val> ``````
<FromGitter> <MrSorcus> > @MrSorcus try `::1` ⏎ ⏎ Not working.
<FromGitter> <MrSorcus> > `> crystal play -b "::1" -p 8080` ⏎ `Listening on http://::1:8080` ⏎ ⏎ Oh, my fault. Syntax for IPv6 everywhere is different. [https://gitter.im/crystal-lang/crystal?at=5b01958dbd10f34a6818e8c4]
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <j8r> Yes with brackets `http://[::1]:8080`
<FromGitter> <MrSorcus> Hmm... `W, [2018-05-20 15:37:17 +00:00 #11650] WARN -- : Invalid Request Origin: http://[::1]:8080`
<FromGitter> <MrSorcus> And what about https://play.crystal-lang.org/#/r/43nn ?
<FromGitter> <vladfaust> Good day all, may I? Please see https://carc.in/#/r/43np, it's my trial to parse Int from generic Param value. Can it be somehow fixed?
<oprypin> D:
<FromGitter> <vladfaust> It's for Prism again. Params can be either strings or complex object (say, JSON body). Fixing this would solve lots of problems
<oprypin> vladfaust, https://carc.in/#/r/43ns
<FromGitter> <vladfaust> And what if `param = Param.new("42")`? This doesn't work.
<oprypin> make a conditional is_a?
<oprypin> dont use macros and dont reopen int
<crystal-gh> [crystal] j8r opened pull request #6110: Remove static linking for macos (master...macos-static) https://git.io/vphHX
greengriminal has joined #crystal-lang
<FromGitter> <vladfaust> Same effect if using `is_a?`
<oprypin> k
<FromGitter> <vladfaust> My bad, it works for `is_a?`
<FromGitter> <vladfaust> Thanks, @oprypin
rohitpaulk has quit [Ping timeout: 256 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <MrSorcus> I think that a problem here - https://github.com/crystal-lang/crystal/blob/01a51265bd1e5e1f942b681abd7923861d134cba/src/compiler/crystal/tools/playground/server.cr#L528 when server started on IPv6... ⏎ This will be broken, because Origin from browser contains brackets, but @host doesn't.
<FromGitter> <girng> @oprypin how do we close the connections from the server? (TCP). i close them with socket.close. however, when i do `netstat -an | wc -l`, it still shows 1,xxx or so. ⏎ and, i even unplugged my modem after i made the connections. and re-logged on the vps, and did netstat again, and they are still established...
greengriminal has quit [Quit: Leaving]
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <manveru> when i build with `crystal build --static --release --no-debug` the binary still seems to have debug info according to `file`
<FromGitter> <manveru> any idea why?
<FromGitter> <bew> Well you said `--no-debug`
<FromGitter> <bew> Ah sorry misread
<FromGitter> <bew> What debug info do you still have?
<FromGitter> <manveru> ah, good point :)
<FromGitter> <manveru> it's from glibc/openssl/etc
<FromGitter> <manveru> i forgot building them without
<oprypin> why didnt anyone tell me that i had a `return` in there? what a silly mistake
<oprypin> i say it's the neighbors that aren't letting me concentrate
<FromGitter> <sdogruyol> lol
<FromGitter> <sdogruyol> oprypin that thing looks interesting, what exactly is that?
<FromGitter> <sdogruyol> 👍
<FromGitter> <vladfaust> Can one `Object.tap` returning the block's result (not self)?
<FromGitter> <vladfaust> I mean, built-in way
<oprypin> vladfaust, could use `try` .........
<FromGitter> <vladfaust> I'm sorry for my questions getting more and more stupid
<FromGitter> <vladfaust> 6 hours of coding, gonna take a break
<crystal-gh> [crystal] asterite opened pull request #6111: Fix: faster compilation for JSON::MappingError (master...fix/slow-json-serialize) https://git.io/vphbn
rohitpaulk has joined #crystal-lang
DTZUZU has quit [Quit: WeeChat 1.9]
rohitpaulk has quit [Quit: Ping timeout (120 seconds)]
DTZUZU has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<oprypin> it's not a stupid question, i was just thinking
<oprypin> 1) it's unusual to need that 2) my suggestion has a quirk
<FromGitter> <vladfaust> e.g. `"foo".self{ |s| "(" + s ")" } # => "(foo)"`
Liothen has quit [*.net *.split]
marius has quit [*.net *.split]
_whitelogger has joined #crystal-lang
Liothen has joined #crystal-lang
<Yxhuvud> vladfaust: class Object; def yield_self; yield self; end; end
<FromGitter> <vladfaust> > I mean, built-in way
<Yxhuvud> no, noone has bothered to try to import that method from ruby yet.
<Yxhuvud> though try is very close in behaviour so there is probably no need for it.
kp666[m] has joined #crystal-lang
olbat[m] has joined #crystal-lang
Liothen has quit [*.net *.split]
ua has quit [*.net *.split]
tilpner has quit [*.net *.split]
davic has quit [*.net *.split]
duper has quit [*.net *.split]
duper has joined #crystal-lang
davic has joined #crystal-lang
ua has joined #crystal-lang
tilpner has joined #crystal-lang
Liothen has joined #crystal-lang
<FromGitter> <jaysneg> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b01ccb52df44c2d06427e0b]
<FromGitter> <jaysneg> can some one help?
rohitpaulk has quit [Ping timeout: 264 seconds]
<Yxhuvud> @jaysneh: looks like somthing is creating more prepared statements than the database allows.
sherjilozair has joined #crystal-lang
<FromGitter> <jaysneg> I need to insert a lot of data from files. How to fix it?
ua has quit [Ping timeout: 265 seconds]
<Yxhuvud> Well, it may be a good idea to file an issue at the Granite git repo, and then my suggestion would be to try to find a small example that shows the error and then dig into the code.
<FromGitter> <drujensen> @jaysneg take a look at batch_size https://github.com/amberframework/granite#batch_size
<FromGitter> <drujensen> this should create multiple statements instead of just one large one
<oprypin> :)
rohitpaulk has joined #crystal-lang
snsei has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
<Yxhuvud> but why is it creating so many prepared statments? Unless every line is very different from other lines, why not reuse the prepared statements?
<FromGitter> <jaysneg> I am parsing json and insert it to db
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <manveru> it seems a bit strange that the compiler doesn't complain if i don't rescue a `File.read` which might go wrong
<oprypin> manveru, complaining would be way stranger
<oprypin> exceptions are not to be feared
<FromGitter> <manveru> I don't like runtime errors :)
<oprypin> this is basically Go
sz0 has joined #crystal-lang
<FromGitter> <silentworks> Anyone using Crystal to build CLI tools?