1

I am trying to create a timeout function inside aws lambda. On my first iteration using multiprocessing library failed because I needed a queue. While it seems necessary to yet implement a timeout function, I just don't want to go through the complexities of implementing it. I found an article that describes what I need using signal library, but a comment below warned of the dangers of using signals in a multithreaded environment. I'm wondering if it's safe to use signals in aws lambda

Silver Flash
  • 871
  • 3
  • 7
  • 16
  • What queue? Python has its own queues. – Marcin Jul 07 '21 at 05:25
  • queue in multiprocessing – Silver Flash Jul 07 '21 at 05:28
  • What's wrong with python's `multiprocessing.Queue`? – Marcin Jul 07 '21 at 05:31
  • I've linked an article that explains this issue better than I could. – Silver Flash Jul 07 '21 at 05:32
  • Lambda functions should finish as quickly as possible and in fact have a limited runtime. Are you sure this is the right approach to begin with? Perhaps you should use one of the other AWS services like CloudWatch to trigger another Lamba call later. – deceze Jul 07 '21 at 05:44
  • @deceze That is a valid point. I haven't considered using a different lambda. But nonetheless, it may yet prove useful to handle a timeout when my current lambda needs a lot of time (say the maximum 15mins), and encounters an error (db unresponsive?) that will cause it to hang indefinitely. – Silver Flash Jul 07 '21 at 05:49

0 Answers0