sendgrid / sendgrid-java

The Official Twilio SendGrid Led, Community Driven Java API Library
https://sendgrid.com
MIT License
485 stars 409 forks source link

Thread safety of the library? #435

Open marshallpierce opened 6 years ago

marshallpierce commented 6 years ago

I see from https://github.com/sendgrid/sendgrid-java/issues/213 that the library is claimed to be thread safe. However, a few minute's inspection of the SendGrid class shows this is not true. All fields are not safely initialized, and therefore all usage of them is unsafe. Similarly, the requestHeaders field is itself mutable and not thread safe. I stopped looking once I found that much, so there may well be more elsewhere. However, the class looks like it was intended to be reused, given that it launches a thread pool (which leaks threads -- there's no way to close the thread pool).

As a potential user of the library, what should I make of this? Is it intended that SendGrid should be thread safe?

thinkingserious commented 6 years ago

Hello @marshallpierce,

Those are some great observations! Thanks for taking the time to detail your findings. I've added this issue to our backlog for further investigation.

If you like, we welcome and encourage PRs :)

With Best Regards,

Elmer

CNunezEng commented 6 years ago

Is this issue still open? I would like to help out.

MarcusBiel commented 4 years ago

Haha over 2 years and this is still open. I am looking for better alternatives then SendGrid! :)

marshallpierce commented 4 years ago

I just wrote my own client since this library is clearly abandonware

harishajdarevic commented 3 years ago

Hi,,

any updates on this?

thinkingserious commented 3 years ago

Hello @harishajdarevic,

No updates just yet, but since you have commented here, we will reopen and add to our internal backlog. Additional comments and +1s will help this issue move up our backlog. Thank you!!

With best regards,

Elmer