aws

http://status.aws.amazon.com/ https://www.expeditedssl.com/aws-in-plain-english
ghadi 2020-03-27T16:46:02.018600Z

thanks for the clear repro @kenny

✔️ 1
2020-03-27T18:27:29.023600Z

I think that was a refactoring oversight.

1
2020-03-27T18:27:41.023900Z

That wasn't all inside a go block before.

kenny 2020-03-27T18:33:44.026700Z

Does response-ch https://github.com/cognitect-labs/aws-api/blob/954bd3c0376d84a7defe5215b9f2dee3059e421f/src/cognitect/aws/client.clj#L82 get garbage collected if region, creds, or endpoint result an anomaly? It seems like a bunch of channels could end up getting built up due to https://github.com/cognitect-labs/aws-api/blob/954bd3c0376d84a7defe5215b9f2dee3059e421f/src/cognitect/aws/client.clj#L107-L115 running even when region/creds/endpoint fetch result in an anomaly.

2020-03-27T18:40:34.028900Z

channels are not special with regards to gc

kenny 2020-03-27T18:41:42.030200Z

Then I'm pretty sure this code could result in a large amount of unused channels.

2020-03-27T18:41:51.030400Z

in this case you can think of response-ch as being a promise, which will be gc'ed when there are no references to it

kenny 2020-03-27T18:42:41.031200Z

Isn't https://github.com/cognitect-labs/aws-api/blob/954bd3c0376d84a7defe5215b9f2dee3059e421f/src/cognitect/aws/client.clj#L109 going to hold a reference to it forever if any branch besides the :else is hit?

2020-03-27T18:43:29.031500Z

no

2020-03-27T18:44:11.031800Z

go blocks are not gc roots like threads are

2020-03-27T18:45:17.033Z

a go block is transformed in to a callback that is registered on a channel, so if there are no other references to a channel, a channel will get gc'ed even if a go block is waiting to put or take from it

kenny 2020-03-27T18:47:18.034500Z

Ah, makes sense! Thanks for that explanation. So in this case, the gc will know immediately there will be no references to response-ch since the :else branch was not run, marking the channel for gc?

2020-03-27T18:49:03.036Z

whenever the gc happens to run, if it decides to collect more garbage, it might eventually notice the channel is garbage

✔️ 1
kenny 2020-03-27T18:51:23.036900Z

So it would follow, why is this code written this way instead of with a transducer?

2020-03-27T18:52:29.037200Z

that question makes no sense

kenny 2020-03-27T18:55:25.039Z

i.e., that second go block seems unnecessary

kenny 2020-03-27T19:06:49.039100Z

Like this

kenny 2020-03-27T19:09:31.039600Z

Or, perhaps even better, this.

kenny 2020-03-27T19:10:33.039900Z

Easier to read a patch...

kenny 2020-03-27T19:13:50.040700Z

This impl seems cleaner & more efficient.

2020-03-27T19:29:28.040900Z

Cleaner is subjective. For me the separation of "here's all the stuff we do to make a request" from "here's what we do with a response" is easier to reason about.

2020-03-27T19:29:42.041100Z

"more efficient" is less so, of course 🙂

2020-03-27T19:29:59.041300Z

Are you just thinking of the extra go block, or something else?

kenny 2020-03-27T19:35:26.041500Z

Fair. And yes, the extra go block.

2020-03-27T19:35:33.041700Z

Got it.

2020-03-27T19:35:47.041900Z

I'm going to leave it as/is for now and get out the change to the thread pool.

1
2020-03-27T19:36:27.042200Z

I appreciate the input, @kenny. Thanks.

kenny 2020-03-27T19:39:56.042400Z

Of course! This library is great. Thanks for taking the time for discussion & maintenance.

2020-03-27T19:48:36.042600Z

Time well invested. I learn things.

✔️ 1