Try 30 days of free premium.

Mysterious API exceptions

DickKluis wrote a year ago: 1

I have been running my TVMaze app written in C# for about 18 months now and since a couple of days I have started getting these errors but very inconsistently and on different API URLs.   All calls get made by the same function and just the URL and it parameters are different.

9/5/2022 7:02:56 AM: WebAPI Async        : 0  --> Exception: The SSL connection could not be established, see inner exception.
9/5/2022 7:02:56 AM: WebAPI Exec         : 3  --> NULL --> Http Response Code is: NULL for API https://api.tvmaze.com/shows/16778

The below extracts from my different logs show that the APIs respond back as expected and work fine and then suddenly one will not and give the above error.

Nothing in my code has changed at all.   HELP 

09/05/2022 06:51:30: Refresh Shows       : 0  --> Refresh Shows Started  ########################################################################################
09/05/2022 06:51:30: Refresh Shows       : 0  --> Debug: running async task shows/3594
09/05/2022 06:51:31: Refresh Shows       : 0  --> Debug: running async task shows/3594/episodes
09/05/2022 06:51:32: Refresh Shows       : 0  --> Debug: running async task episodes/560876?embed=show
09/05/2022 06:51:33: Refresh Shows       : 0  --> Debug: running async task episodes/560876
09/05/2022 06:51:34: Refresh Shows       : 0  --> Debug: running async task episodes/731302?embed=show
09/05/2022 06:51:35: Refresh Shows       : 0  --> Debug: running async task episodes/731302
09/05/2022 06:51:36: Refresh Shows       : 0  --> Debug: running async task episodes/731303?embed=show
09/05/2022 06:51:36: Refresh Shows       : 0  --> Debug: running async task episodes/731303
09/05/2022 06:51:37: Refresh Shows       : 0  --> Debug: running async task episodes/731304?embed=show
09/05/2022 06:51:38: Refresh Shows       : 0  --> Debug: running async task episodes/731304
09/05/2022 06:51:39: Refresh Shows       : 0  --> Debug: running async task episodes/731305?embed=show
09/05/2022 06:51:40: Refresh Shows       : 0  --> Debug: running async task episodes/731305
09/05/2022 06:51:41: Refresh Shows       : 0  --> Debug: running async task episodes/731306?embed=show
09/05/2022 06:51:43: Refresh Shows       : 0  --> Debug: running async task episodes/731306
09/05/2022 06:51:44: Refresh Shows       : 0  --> Debug: running async task episodes/731307?embed=show
09/05/2022 06:51:45: Refresh Shows       : 0  --> Debug: running async task episodes/731307
09/05/2022 06:51:46: Refresh Shows       : 0  --> Debug: running async task episodes/731308?embed=show
09/05/2022 06:51:47: Refresh Shows       : 0  --> Debug: running async task episodes/731308
09/05/2022 06:51:47: Refresh Shows       : 0  --> Debug: running async task episodes/731309?embed=show
09/05/2022 06:51:48: Refresh Shows       : 0  --> Debug: running async task episodes/731309
09/05/2022 06:51:49: Refresh Shows       : 0  --> Debug: running async task episodes/731310?embed=show
09/05/2022 06:51:49: WebAPI Async        : 0  --> Exception: The SSL connection could not be established, see inner exception.

9/5/2022 7:07:42 AM: Refresh Shows       : 0  --> Refresh Shows Started  ########################################################################################
9/5/2022 7:07:42 AM: Refresh Shows       : 2  --> Working on Show not updated in 7 days 8400
9/5/2022 7:07:42 AM: Refresh Shows       : 0  --> Debug: running async task shows/8400
9/5/2022 7:07:43 AM: Refresh Shows       : 0  --> Debug: running async task shows/8400/episodes
9/5/2022 7:07:43 AM: Refresh Shows       : 0  --> Debug: running async task episodes/670652?embed=show
9/5/2022 7:07:44 AM: Refresh Shows       : 0  --> Debug: running async task episodes/670652
9/5/2022 7:07:44 AM: Refresh Shows       : 0  --> Debug: running async task episodes/680434?embed=show
9/5/2022 7:07:45 AM: Refresh Shows       : 0  --> Debug: running async task episodes/680434
9/5/2022 7:07:45 AM: Refresh Shows       : 0  --> Debug: running async task episodes/695022?embed=show
9/5/2022 7:07:46 AM: Refresh Shows       : 0  --> Debug: running async task episodes/695022
9/5/2022 7:07:47 AM: Refresh Shows       : 0  --> Debug: running async task episodes/711145?embed=show
9/5/2022 7:07:47 AM: Refresh Shows       : 0  --> Debug: running async task episodes/711145
9/5/2022 7:07:48 AM: Refresh Shows       : 0  --> Debug: running async task episodes/729067?embed=show
9/5/2022 7:07:48 AM: Refresh Shows       : 0  --> Debug: running async task episodes/729067
9/5/2022 7:07:49 AM: Refresh Shows       : 0  --> Debug: running async task episodes/750947?embed=show
9/5/2022 7:07:49 AM: Refresh Shows       : 0  --> Debug: running async task episodes/750947
9/5/2022 7:07:50 AM: Refresh Shows       : 0  --> Debug: running async task episodes/750950?embed=show
9/5/2022 7:07:51 AM: Refresh Shows       : 0  --> Debug: running async task episodes/750950
9/5/2022 7:07:51 AM: Refresh Shows       : 0  --> Debug: running async task episodes/750955?embed=show
9/5/2022 7:07:52 AM: Refresh Shows       : 0  --> Debug: running async task episodes/750955
9/5/2022 7:07:52 AM: Refresh Shows       : 0  --> Debug: running async task episodes/1406423?embed=show
9/5/2022 7:07:53 AM: Refresh Shows       : 0  --> Debug: running async task episodes/1406423
9/5/2022 7:07:53 AM: Refresh Shows       : 0  --> Debug: running async task episodes/1409296?embed=show
9/5/2022 7:07:54 AM: WebAPI Async        : 0  --> Exception: The SSL connection could not be established, see inner exception.
9/5/2022 7:07:54 AM: WebAPI Exec         : 3  --> NULL --> Http Response Code is: NULL for API https://api.tvmaze.com/episodes/1409296?embed=show


9/5/2022 7:06:29 AM: RefreshOneShow WebU : 0  --> RefreshOneShow WebUI Started  ########################################################################################
9/5/2022 7:06:29 AM: RefreshOneShow WebU : 2  --> Working on Show 19809 The Resident
9/5/2022 7:06:31 AM: WebAPI Async        : 3  --> Exception: The SSL connection could not be established, see inner exception.
9/5/2022 7:06:31 AM: WebAPI Exec         : 3  --> NULL --> Http Response Code is: NULL for API https://api.tvmaze.com/episodes/1360106?embed=show

09/05/2022 06:47:49: Update Show Epochs  : 0  --> Update Show Epochs Started  ########################################################################################
09/05/2022 06:47:49: Update Show Epochs  : 0  --> Debug: running async task updates/shows?since=day
09/05/2022 06:47:51: Update Show Epochs  : 0  --> Debug: running async task shows/3948
09/05/2022 06:47:51: Update Show Epochs  : 0  --> Debug: running async task shows/3972
09/05/2022 06:47:52: Update Show Epochs  : 0  --> Debug: running async task shows/3983
09/05/2022 06:47:52: Update Show Epochs  : 0  --> Debug: running async task shows/4022
09/05/2022 06:47:53: Update Show Epochs  : 0  --> Debug: running async task shows/4053
09/05/2022 06:47:53: Update Show Epochs  : 0  --> Debug: running async task shows/4085
09/05/2022 06:47:54: Update Show Epochs  : 0  --> Debug: running async task shows/4378
09/05/2022 06:47:55: Update Show Epochs  : 0  --> Debug: running async task shows/4382
09/05/2022 06:47:55: Update Show Epochs  : 0  --> Debug: running async task shows/4512
09/05/2022 06:47:56: Update Show Epochs  : 0  --> Debug: running async task shows/4794
09/05/2022 06:47:56: Update Show Epochs  : 0  --> Debug: running async task shows/5421
09/05/2022 06:47:57: Update Show Epochs  : 0  --> Debug: running async task shows/5604
09/05/2022 06:47:57: Update Show Epochs  : 0  --> Debug: running async task shows/5908
09/05/2022 06:47:58: Update Show Epochs  : 0  --> Debug: running async task shows/5977
09/05/2022 06:47:58: Update Show Epochs  : 0  --> Debug: running async task shows/6137
09/05/2022 06:47:59: Update Show Epochs  : 0  --> Debug: running async task shows/6160
09/05/2022 06:48:00: Update Show Epochs  : 0  --> Debug: running async task shows/6446
09/05/2022 06:48:00: Update Show Epochs  : 0  --> Debug: running async task shows/6629
09/05/2022 06:48:01: Update Show Epochs  : 0  --> Debug: running async task shows/6676
09/05/2022 06:48:01: Update Show Epochs  : 0  --> Debug: running async task shows/7220
09/05/2022 06:48:01: WebAPI Async        : 0  --> Exception: The SSL connection could not be established, see inner exception.

9/5/2022 7:01:47 AM: Update Show Epochs  : 0  --> Update Show Epochs Started  ########################################################################################
9/5/2022 7:01:47 AM: Update Show Epochs  : 2  --> Last Evaluated ShowId = 63861
9/5/2022 7:01:47 AM: Update Show Epochs  : 0  --> Debug: running async task updates/shows?since=day
9/5/2022 7:01:48 AM: Update Show Epochs  : 2  --> Found 353 updates on Tvmaze
9/5/2022 7:01:48 AM: Update Show Epochs  : 0  --> Debug: running async task shows/5229
9/5/2022 7:01:48 AM: Update Show Epochs  : 0  --> Debug: running async task shows/7220
9/5/2022 7:01:49 AM: Update Show Epochs  : 0  --> Debug: running async task shows/7264
9/5/2022 7:01:50 AM: Update Show Epochs  : 0  --> Debug: running async task shows/7369
9/5/2022 7:01:50 AM: Update Show Epochs  : 0  --> Debug: running async task shows/7432
9/5/2022 7:01:51 AM: Update Show Epochs  : 0  --> Debug: running async task shows/7454
9/5/2022 7:01:51 AM: Update Show Epochs  : 0  --> Debug: running async task shows/7456
9/5/2022 7:01:52 AM: Update Show Epochs  : 3  --> Inserted Epoch Record 7456 Begin Japanology
9/5/2022 7:01:52 AM: Update Show Epochs  : 3  --> This show is evaluated already
9/5/2022 7:01:52 AM: Update Show Epochs  : 0  --> Debug: running async task shows/7847
9/5/2022 7:01:52 AM: Update Show Epochs  : 0  --> Debug: running async task shows/8420
9/5/2022 7:01:53 AM: Update Show Epochs  : 0  --> Debug: running async task shows/8421
9/5/2022 7:01:53 AM: Update Show Epochs  : 0  --> Debug: running async task shows/9065
9/5/2022 7:01:54 AM: Update Show Epochs  : 0  --> Debug: running async task shows/9070
9/5/2022 7:01:55 AM: Update Show Epochs  : 0  --> Debug: running async task shows/9075
9/5/2022 7:01:55 AM: Update Show Epochs  : 0  --> Debug: running async task shows/9311
9/5/2022 7:01:56 AM: Update Show Epochs  : 0  --> Debug: running async task shows/9312
9/5/2022 7:01:56 AM: Update Show Epochs  : 0  --> Debug: running async task shows/9472
9/5/2022 7:01:57 AM: Update Show Epochs  : 0  --> Debug: running async task shows/10034
9/5/2022 7:01:57 AM: WebAPI Async        : 0  --> Exception: The SSL connection could not be established, see inner exception.
9/5/2022 7:01:57 AM: WebAPI Exec         : 3  --> NULL --> Http Response Code is: NULL for API https://api.tvmaze.com/shows/10034

9/5/2022 7:02:44 AM: Update Show Epochs  : 0  --> Update Show Epochs Started  ########################################################################################
9/5/2022 7:02:44 AM: Update Show Epochs  : 2  --> Last Evaluated ShowId = 63861
9/5/2022 7:02:44 AM: Update Show Epochs  : 0  --> Debug: running async task updates/shows?since=day
9/5/2022 7:02:45 AM: Update Show Epochs  : 2  --> Found 353 updates on Tvmaze
9/5/2022 7:02:45 AM: Update Show Epochs  : 0  --> Debug: running async task shows/10034
9/5/2022 7:02:46 AM: Update Show Epochs  : 0  --> Debug: running async task shows/10330
9/5/2022 7:02:46 AM: Update Show Epochs  : 0  --> Debug: running async task shows/10333
9/5/2022 7:02:47 AM: Update Show Epochs  : 0  --> Debug: running async task shows/10687
9/5/2022 7:02:47 AM: Update Show Epochs  : 0  --> Debug: running async task shows/10796
9/5/2022 7:02:48 AM: Update Show Epochs  : 0  --> Debug: running async task shows/10848
9/5/2022 7:02:50 AM: Update Show Epochs  : 0  --> Debug: running async task shows/11286
9/5/2022 7:02:50 AM: Update Show Epochs  : 3  --> Inserted Epoch Record 11286 The Farmer Wants a Wife
9/5/2022 7:02:50 AM: Update Show Epochs  : 3  --> This show is evaluated already
9/5/2022 7:02:50 AM: Update Show Epochs  : 0  --> Debug: running async task shows/11436
9/5/2022 7:02:51 AM: Update Show Epochs  : 0  --> Debug: running async task shows/12930
9/5/2022 7:02:51 AM: Update Show Epochs  : 0  --> Debug: running async task shows/13025
9/5/2022 7:02:52 AM: Update Show Epochs  : 0  --> Debug: running async task shows/13105
9/5/2022 7:02:52 AM: Update Show Epochs  : 0  --> Debug: running async task shows/13184
9/5/2022 7:02:53 AM: Update Show Epochs  : 0  --> Debug: running async task shows/13537
9/5/2022 7:02:54 AM: Update Show Epochs  : 0  --> Debug: running async task shows/14857
9/5/2022 7:02:54 AM: Update Show Epochs  : 0  --> Debug: running async task shows/15884
9/5/2022 7:02:55 AM: Update Show Epochs  : 0  --> Debug: running async task shows/16504
9/5/2022 7:02:55 AM: Update Show Epochs  : 0  --> Debug: running async task shows/16684
9/5/2022 7:02:56 AM: Update Show Epochs  : 0  --> Debug: running async task shows/16778
9/5/2022 7:02:56 AM: WebAPI Async        : 0  --> Exception: The SSL connection could not be established, see inner exception.
9/5/2022 7:02:56 AM: WebAPI Exec         : 3  --> NULL --> Http Response Code is: NULL for API https://api.tvmaze.com/shows/16778

9/5/2022 7:03:11 AM: Update Show Epochs  : 0  --> Update Show Epochs Started  ########################################################################################
9/5/2022 7:03:11 AM: Update Show Epochs  : 2  --> Last Evaluated ShowId = 63861
9/5/2022 7:03:11 AM: Update Show Epochs  : 0  --> Debug: running async task updates/shows?since=day
9/5/2022 7:03:12 AM: Update Show Epochs  : 2  --> Found 353 updates on Tvmaze
9/5/2022 7:03:12 AM: Update Show Epochs  : 0  --> Debug: running async task shows/16778
9/5/2022 7:03:13 AM: Update Show Epochs  : 0  --> Debug: running async task shows/16895
9/5/2022 7:03:13 AM: Update Show Epochs  : 0  --> Debug: running async task shows/17392
9/5/2022 7:03:14 AM: Update Show Epochs  : 0  --> Debug: running async task shows/17424
9/5/2022 7:03:14 AM: Update Show Epochs  : 0  --> Debug: running async task shows/17470
9/5/2022 7:03:15 AM: Update Show Epochs  : 0  --> Debug: running async task shows/17495
9/5/2022 7:03:15 AM: Update Show Epochs  : 0  --> Debug: running async task shows/18132
9/5/2022 7:03:16 AM: Update Show Epochs  : 0  --> Debug: running async task shows/18265
9/5/2022 7:03:16 AM: Update Show Epochs  : 0  --> Debug: running async task shows/18565
9/5/2022 7:03:17 AM: Update Show Epochs  : 3  --> Inserted Epoch Record 18565 Jeff Ross Presents Roast Battle
9/5/2022 7:03:17 AM: Update Show Epochs  : 3  --> This show is evaluated already
9/5/2022 7:03:17 AM: Update Show Epochs  : 0  --> Debug: running async task shows/18891
9/5/2022 7:03:18 AM: Update Show Epochs  : 0  --> Debug: running async task shows/19020
9/5/2022 7:03:18 AM: Update Show Epochs  : 0  --> Debug: running async task shows/19022
9/5/2022 7:03:19 AM: Update Show Epochs  : 0  --> Debug: running async task shows/19499
9/5/2022 7:03:19 AM: Update Show Epochs  : 0  --> Debug: running async task shows/19809
9/5/2022 7:03:20 AM: Update Show Epochs  : 0  --> Debug: running async task shows/19809/episodes
9/5/2022 7:03:21 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/1360106?embed=show
9/5/2022 7:03:22 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/1360106
9/5/2022 7:03:22 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/1360107?embed=show
9/5/2022 7:03:23 AM: WebAPI Async        : 0  --> Exception: The SSL connection could not be established, see inner exception.
9/5/2022 7:03:23 AM: WebAPI Exec         : 3  --> NULL --> Http Response Code is: NULL for API https://api.tvmaze.com/episodes/1360107?embed=show

9/5/2022 7:04:11 AM: Update Show Epochs  : 0  --> Update Show Epochs Started  ########################################################################################
9/5/2022 7:04:11 AM: Update Show Epochs  : 2  --> Last Evaluated ShowId = 63861
9/5/2022 7:04:11 AM: Update Show Epochs  : 0  --> Debug: running async task updates/shows?since=day
9/5/2022 7:04:12 AM: Update Show Epochs  : 2  --> Found 353 updates on Tvmaze
9/5/2022 7:04:12 AM: Update Show Epochs  : 0  --> Debug: running async task shows/20473
9/5/2022 7:04:12 AM: Update Show Epochs  : 0  --> Debug: running async task shows/21349
9/5/2022 7:04:13 AM: Update Show Epochs  : 3  --> Inserted Epoch Record 21349 Rugby League: Super League Highlights
9/5/2022 7:04:13 AM: Update Show Epochs  : 3  --> This show is evaluated already
9/5/2022 7:04:13 AM: Update Show Epochs  : 0  --> Debug: running async task shows/21518
9/5/2022 7:04:13 AM: Update Show Epochs  : 3  --> Inserted Epoch Record 21518 De zevende dag
9/5/2022 7:04:13 AM: Update Show Epochs  : 3  --> This show is evaluated already
9/5/2022 7:04:13 AM: Update Show Epochs  : 0  --> Debug: running async task shows/21656
9/5/2022 7:04:14 AM: Update Show Epochs  : 0  --> Debug: running async task shows/21867
9/5/2022 7:04:15 AM: Update Show Epochs  : 0  --> Debug: running async task shows/22438
9/5/2022 7:04:15 AM: Update Show Epochs  : 3  --> Inserted Epoch Record 22438 Rapunzel's Tangled Adventure
9/5/2022 7:04:15 AM: Update Show Epochs  : 3  --> This show is evaluated already
9/5/2022 7:04:15 AM: Update Show Epochs  : 0  --> Debug: running async task shows/22918
9/5/2022 7:04:16 AM: Update Show Epochs  : 0  --> Debug: running async task shows/23252
9/5/2022 7:04:16 AM: Update Show Epochs  : 0  --> Debug: running async task shows/23503
9/5/2022 7:04:17 AM: Update Show Epochs  : 0  --> Debug: running async task shows/23665
9/5/2022 7:04:17 AM: Update Show Epochs  : 0  --> Debug: running async task shows/23796
9/5/2022 7:04:18 AM: Update Show Epochs  : 0  --> Debug: running async task shows/24644
9/5/2022 7:04:18 AM: Update Show Epochs  : 0  --> Debug: running async task shows/24722
9/5/2022 7:04:19 AM: Update Show Epochs  : 0  --> Debug: running async task shows/24921
9/5/2022 7:04:19 AM: Update Show Epochs  : 0  --> Debug: running async task shows/25579
9/5/2022 7:04:20 AM: Update Show Epochs  : 3  --> Inserted Epoch Record 25579 Kell on Earth
9/5/2022 7:04:20 AM: Update Show Epochs  : 3  --> This show is evaluated already
9/5/2022 7:04:20 AM: Update Show Epochs  : 0  --> Debug: running async task shows/27388
9/5/2022 7:04:21 AM: Update Show Epochs  : 0  --> Debug: running async task shows/28152
9/5/2022 7:04:21 AM: Update Show Epochs  : 0  --> Debug: running async task shows/29751
9/5/2022 7:04:22 AM: Update Show Epochs  : 0  --> Debug: running async task shows/30158
9/5/2022 7:04:22 AM: Update Show Epochs  : 0  --> Debug: running async task shows/30586
9/5/2022 7:04:23 AM: WebAPI Async        : 0  --> Exception: The SSL connection could not be established, see inner exception.
9/5/2022 7:04:23 AM: WebAPI Exec         : 3  --> NULL --> Http Response Code is: NULL for API https://api.tvmaze.com/shows/30586

9/5/2022 7:04:47 AM: Update Show Epochs  : 0  --> Update Show Epochs Started  ########################################################################################
9/5/2022 7:04:47 AM: Update Show Epochs  : 2  --> Last Evaluated ShowId = 63861
9/5/2022 7:04:47 AM: Update Show Epochs  : 0  --> Debug: running async task updates/shows?since=day
9/5/2022 7:04:48 AM: Update Show Epochs  : 2  --> Found 353 updates on Tvmaze
9/5/2022 7:04:48 AM: Update Show Epochs  : 0  --> Debug: running async task shows/30586
9/5/2022 7:04:49 AM: Update Show Epochs  : 0  --> Debug: running async task shows/31362
9/5/2022 7:04:49 AM: Update Show Epochs  : 0  --> Debug: running async task shows/31727
9/5/2022 7:04:50 AM: Update Show Epochs  : 3  --> Inserted Epoch Record 31727 Roast Battle
9/5/2022 7:04:50 AM: Update Show Epochs  : 3  --> This show is evaluated already
9/5/2022 7:04:50 AM: Update Show Epochs  : 0  --> Debug: running async task shows/32354
9/5/2022 7:04:50 AM: Update Show Epochs  : 0  --> Debug: running async task shows/33233
9/5/2022 7:04:51 AM: Update Show Epochs  : 0  --> Debug: running async task shows/33352
9/5/2022 7:04:51 AM: Update Show Epochs  : 0  --> Debug: running async task shows/33352/episodes
9/5/2022 7:04:52 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/2141182?embed=show
9/5/2022 7:04:52 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/2141182
9/5/2022 7:04:53 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/2276050?embed=show
9/5/2022 7:04:53 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/2276050
9/5/2022 7:04:54 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/2275060?embed=show
9/5/2022 7:04:55 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/2275060
9/5/2022 7:04:55 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/2275061?embed=show
9/5/2022 7:04:56 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/2275061
9/5/2022 7:04:56 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/2275062?embed=show
9/5/2022 7:04:57 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/2275062
9/5/2022 7:04:57 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/2275064?embed=show
9/5/2022 7:04:58 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/2275064
9/5/2022 7:04:58 AM: Update Show Epochs  : 0  --> Debug: running async task episodes/2275065?embed=show
9/5/2022 7:04:59 AM: WebAPI Async        : 0  --> Exception: The SSL connection could not be established, see inner exception.

 


david wrote a year ago: 1

That's probably not a coincidence; unfortunately we had to ramp up the ddos protection a bit over the past weeks, because our servers were getting hammered.

Looking at your logs my first question is: are you properly closing or re-using your HTTP(S) connections after the request is completed, instead of leaving them idle?

DickKluis wrote a year ago: 1

I did not know to close them, so there is no code that I wrote for it.  So probably just leaving them idle.   

Thx, I'll be looking into how to close them.   Do you happen to have inside into that for C#?

 


david wrote a year ago: 1

I don't have experience in C# myself, but perhaps if you can share the relevant parts of your code I can help you on your way.

DickKluis wrote a year ago: 1

Never mind found something and it looks like it is working now.   Adding a .dispose() method at the end of the call process.

Appreciate the support you always give, even on Labor Day :-)


david wrote a year ago: 1

Great! Just out of curiosity: are you creating a new HttpClient instance for every request? Because the documentation suggests everything should be fine if you just keep re-using a single instance:

HttpClient is intended to be instantiated once and reused throughout the life of an application. In .NET Core and .NET 5+, HttpClient pools connections inside the handler instance and reuses a connection across multiple requests.

DickKluis wrote a year ago: 1

I am disposing the httpclient instance so I guess I am.   Does not seem to affect the speed of the processing though.   I am on dotnet 6 and using C#10 both are the latest stable release.   It seemed to have fixed the SSL connection issue.   

DickKluis wrote a year ago: 1

private async Task PerformTvmApiAsync(string api)
{
    try
    {
        _httpResponse = await _client.GetAsync(api).ConfigureAwait(false);
        IsTimedOut = false;
    }
    catch (Exception e)
    {
        _log.Write($"Exception: {e.Message}", "WebAPI Async", 0);
        if (e.Message.Contains(" seconds elapsing") || e.Message.Contains("Operation timed out"))
        {
            _log.Write($"Retrying Now: {api}", "WebAPI Async");
            try
            {
                _httpResponse = await _client.GetAsync(api).ConfigureAwait(false);
            }
            catch (Exception ee)
            {
                _log.Write($"2nd Exception: {ee.Message}", "WebAPI Async");
                _httpResponse = new HttpResponseMessage();
                IsTimedOut = true;
                Console.WriteLine(
                    "########### Aborting from PerformTvmApiAsync 2nd Exception ###################");
                Environment.Exit(99);
            }
        }
    }
    finally
    {
        _client.Dispose();
    }
}


david wrote a year ago: 1

I don't think that snippet has enough information for me to judge (I don't see how/when _client is initialized), but thanks for sharing.

In general for anyone else who's reading: make sure you don't leave multiple HTTP connections idling after the request has been completed. Either close the connection after every request, or re-use the existing connection for subsequent requests, or use a client with support for HTTP2 multiplexing. Otherwise you're wasting resources on both your and our end, and our ddos filters might kick in eventually.

Try 30 days of free premium.