Hangfire active server going down frequently and throwing StackOverflow Exception when new server is internally spun up

Tags: #<Tag:0x00007f49a3c672c8> #<Tag:0x00007f49a3c67160> #<Tag:0x00007f49a3c67020>



We have an asp.net core 2.1 application where we use Hangfire to manage recurring jobs. We have noticed that after upgrading from

  1. Hangfire version 1.7.2 to 1.7.8
  2. Hangfire.MemoryStorage version from 1.6.0 to 1.6.3
  3. Hangfire.PostgresSql version from 1.6.0 to 1.6.3
    we have StackOverflowExceptions loggged frequently causing 502 exceptions while accessing the app server( Both Hangfire and Application are hosted on same server)

On investigating further, we see that the active server goes down frequently. (No relevant logs are seen for the cause of these events after enabling hangfire trace logging)
This is followed by bringing up new server. At this exact time, we observe StackOverflowException in the logs, causing app to restart.

Please help resolve the issue as this is a very frequent occurrence given the application load.