<FromGitter>
<Dan-Do> I don't know it is because of db, or pooling or business logic processing...
<FromGitter>
<Dan-Do> the `call_next(context)` is more or less like your Athena's Controller
<FromGitter>
<naqvis> @Dan-Do there is no way, timeout will happen on channel, so it got no relation with any specific fiber
<FromGitter>
<Blacksmoke16> not entirely, thats more of how the other frameworks work. I.e. an `Array(HTTP::Handler)`
<FromGitter>
<naqvis> what you need is detailed logging inside your logic, so that you can capture detailed information and see what is happening or what is causing the delay
<FromGitter>
<Dan-Do> Ok I will go with logging. Can I narrow the log by just logging the fibers which has running time longer than ex 30.seconds
<FromGitter>
<Dan-Do> I don't see any method like `Fiber.current.running_time`
<FromGitter>
<naqvis> no
<FromGitter>
<naqvis> simple approach would be ⏎ ⏎ 1) start the timer before you call call_next ⏎ 2) Log fiber-id and other specific details like what work its doing ⏎ 3) after method returns, log the time it took to process the request [https://gitter.im/crystal-lang/crystal?at=60c37591d855766185d079aa]
<FromGitter>
<Blacksmoke16> does literally the same thing, just via a built in method
<FromGitter>
<naqvis> oh yeah ^
avane has quit [*.net *.split]
avane has joined #crystal-lang
<FromGitter>
<didactic-drunk> How can i compare `Pointer(UInt8)@0xffffffffffffffff` with a platform type specific `-1`? `mmap` returns `-1`
<yxhuvud>
pointer.address.
<yxhuvud>
and then go from there.
<yxhuvud>
didactic-drunk: btw, you are doing some fairly interesting stuff in concurrent.cr.
<FromGitter>
<naqvis> @didactic-drunk `Pointer(UInt8)` with signed value? how can that happen?
<yxhuvud>
naqvis: -1 would be the error code of mmap.
<FromGitter>
<naqvis> point i'm making is unsigned int can't have signed values, so pointer type he is using is wrong
<yxhuvud>
I mean, it is pointing *to* an uint8. But the address ffffffffffffffff is clearly not a pointer as it isn't a valid address.
<FromGitter>
<naqvis> in that case shouldn't the `Pointer#null?` be used to validate the pointer?
<yxhuvud>
but it isn't a null pointer.
<yxhuvud>
(unless the machine is very weird and happen to define ffffffffffffffff to be null)
<FromGitter>
<naqvis> true but `0xffffffffffffffff` is normally segfault
<FromGitter>
<naqvis> so either that is a dangling pointer or some other issues
<FromGitter>
<HertzDevil> c libraries have this weird habit of casting special values to `void*` directly
<yxhuvud>
No, it is the return code from a syscall. It is very common to let negative result values indicate error status and positive be some other type.
<FromGitter>
<HertzDevil> including posix's c libraries
<FromGitter>
<HertzDevil> or should i say api
<yxhuvud>
Yes. And io_uring and a bunch of others.
<FromGitter>
<HertzDevil> so @naqvis it is not so much an "issue" as it is part of c's tradition
<FromGitter>
<naqvis> :P , yeah and C do that for reference types
<FromGitter>
<naqvis> i mean for FFI where you know C is returning a reference then isn't `out` a better choice?
<yxhuvud>
Not really an option for mmap.
<FromGitter>
<naqvis> just looked into `mmap` manpage :P
<FromGitter>
<naqvis> @didactic-drunk you can do a comparison against `Pointer(Void*).new(-1)`
<FromGitter>
<HertzDevil> for the record, that constructor calls `-1.to_u64!`
<FromGitter>
<HertzDevil> that's due to the abi, not the c standard
<FromGitter>
<naqvis> yeah true, but this does answer the original question on how to find out if `mmap` failed
<FromGitter>
<HertzDevil> it will break silently if c's `void*` is smaller than crystal's `Pointer(Void)` and zero extension is performed instead of sign extension
<FromGitter>
<HertzDevil> what's doable is still doing that and then comparing your pointer to the return value of `test` instead
<FromGitter>
<HertzDevil> and not to a `Pointer(Void)` created in crystal
<FromGitter>
<HertzDevil> for portability
<FromGitter>
<naqvis> but invoking FFI, crystal is yielding the same result as it do for `Pointer(Void)` ⏎ `p! Test.test # => Pointer(Void)@0xffffffffffffffff`
<FromGitter>
<naqvis> is crystal doing some conversions behind the scenes?
<FromGitter>
<didactic-drunk> I think `0x0` is a valid mapping/success return value for `mmap` so `-1` is used.
<FromGitter>
<naqvis> yeah, make sense
<FromGitter>
<didactic-drunk> Will `Pointer(UInt8).new(-1)` end up optimized to a constant single value or should I store a copy for comparison?
<FromGitter>
<naqvis> should be same for each invocation
<FromGitter>
<naqvis> as we are giving the same address
<FromGitter>
<naqvis> but for easy maintenance, better to have constant defined like MMAP_FAILED
postmodern has joined #crystal-lang
<FromGitter>
<foxxx0> Hi, I'm trying to spawn a long-running process in the background that occasionally prints something on stdout. i want to have that Fiber blocking until the next line on stdout, which works fine using `#gets` on the stdout pipe. however, as soon as this fiber is part of my multi-fiber application, the other fibers seem to be blocked too
<FromGitter>
<didactic-drunk> Is it possible to have multiple flags type params filled using symbols? https://carc.in/#/r/bbk7
<FromGitter>
<elorest> Oh really? That's probably more what I was looking for. I didn't realize calling first on an empty array would be ok. Would that work for a hash value as well?
edegaru has joined #crystal-lang
<FromGitter>
<elorest> That's great. Thank you. Pretty much the answer I was looking for.
edegaru has quit [Read error: Connection reset by peer]