在AWS Lambda上另一个线程运行时出现SSL握手异常(Java)

huangapple go评论79阅读模式
英文:

SSLHandshakeException when running on another thread on AWS Lambda (Java)

问题

我在使用Java在AWS Lambda上的另一个线程进行API调用时遇到以下错误:

javax.net.ssl.SSLHandshakeException: 远程主机在握手期间关闭连接

当我在本地运行时,代码是正常的。但在AWS Lambda上运行时:

  • 如果我在主线程上运行,调用是正常的。
  • 如果我在没有API调用的情况下在第二个线程上运行,程序也正常。

我怀疑AWS Lambda的第二个线程可能与SSL设置有关的问题。有人遇到过这个问题吗?希望能听到您的分享。

英文:

I experience the following error when I make an api call from another thread on AWS Lambda, using Java.

> javax.net.ssl.SSLHandshakeException:Remote host closed connection
> during Handshake

The code is fine when I run at local.
But when I run on AWS Lambda:

  • If I run it on the main thread, the call is fine.
  • If I run on the second thread without the api call, the program is fine as well.

I suspect the second thread of AWS Lambda may have some problem with the SSL set up.
Did any experience this? Hope can receive your sharing.

答案1

得分: 1

在AWS Lambda上运行多线程应用不太推荐。

以下是更多详细信息,可以参考:https://dzone.com/articles/multi-threaded-programming-with-aws-lambda

英文:

Having multithreaded application running on a AWS lambda is not so recommended.

Here some more details what to expect
https://dzone.com/articles/multi-threaded-programming-with-aws-lambda

huangapple
  • 本文由 发表于 2020年9月10日 17:57:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/63827211.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定