Hangfire.Console icon indicating copy to clipboard operation
Hangfire.Console copied to clipboard

Constantly polling for the same output rows

Open haxzorer opened this issue 5 years ago • 11 comments

I am trying to get this integrated into a project I'm working on, but are experiencing a weird issue.

When viewing the job page, the console part of the page keeps polling for "new" rows, even thought there are no new rows, and just keeps getting the same (in this case) 2 rows back, going on for what seems to be an inlimited number of time (I haven't sat around long enough to se if it stops).

I'm trying to figure out what I could have done wrong? The output, as far as I have tested, works as expected otherwise.

A short recording showing the issue. The output should just be this

 +5.122s  Hello, world 1
+10.132s  Hello, world 2

ezgif-7-7a4911e7265f

haxzorer avatar Aug 13 '20 12:08 haxzorer

As I see it, the extension cannot tell if the job is still in the Processing state.

What storage provider are you using? Most of weird problems are usually related to the 3rd party implementations not strictly following the rules set by the official ones.

Also check the JS console if there's any errors.

pieceofsummer avatar Aug 13 '20 16:08 pieceofsummer

@pieceofsummer Yes, Redis is used as a storage provider, through the Hangfire.Redis.StackExchange I think. Not 110% sure about all the details, since I was not the one in my team that set this up, but the code uses this bit to configure Hangfire:

services.AddHangfire(configuration => configuration
             .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
             .UseSimpleAssemblyNameTypeSerializer()
             .UseRecommendedSerializerSettings()
             .UseSerilogLogProvider()
             .UseConsole()
             .UseRedisStorage(Redis,
                 new Hangfire.Redis.RedisStorageOptions
                 {
                     Prefix = Configuration["Environment"]
                 }
             ));

And these are the packages related to Hangfire:

    <PackageReference Include="Hangfire.AspNetCore" Version="1.7.11" />
    <PackageReference Include="Hangfire.Console" Version="1.4.2" />
    <PackageReference Include="Hangfire.Redis.StackExchange" Version="1.8.4" />

I checked the JS console, but the only thing there is this:

polling was started

haxzorer avatar Aug 13 '20 17:08 haxzorer

That's interesting. I'm using Redis provider with Console on my server with no issues. Can you provide a minimal project to reproduce your issue?

pieceofsummer avatar Aug 14 '20 08:08 pieceofsummer

@pieceofsummer Sorry for the late reply, I'm working on getting a minimal project to you!

haxzorer avatar Aug 16 '20 17:08 haxzorer

@pieceofsummer I have added a minimal project in a public repo: https://github.com/haxzorer/HangfireConsoleTest

When I run this, like it is described in the readme, I get the same issue that I have reported here. I would be very grateful if you could look at it, and see if there is something that I have overlooked, or just plain gotten wrong, when setting everything up!

haxzorer avatar Aug 16 '20 20:08 haxzorer

Sorry for the delay, finally got some time to take a look.

Unfortunately, I wasn't able to reproduce the issue: Screenshot 2020-08-19 at 23 22 14

Try clearing your browser cache or trying different browser. Could be a caching issue, since Console injects own JS into Hangfire scripts.

pieceofsummer avatar Aug 19 '20 20:08 pieceofsummer

@pieceofsummer Hmm, strange, since I tried it in both Chrome and Safari, and Safari hade previously never visited the site.

Something to note though, is that we recently deployed the project we are using this package in to AWS, using Redis through AWS, and there it works as expected! Is there some kind of Redis configuration that could/should be done locally, that you know of?

haxzorer avatar Aug 19 '20 20:08 haxzorer

Nothing special I know of, except for key eviction should be disabled so there's no data deleted because of keyspace being filled up.

pieceofsummer avatar Aug 19 '20 20:08 pieceofsummer

@pieceofsummer Okay, but thank you for testing it out! I'll see if I ever get it working locally. Regardless, it works beautifully in our production environment, so thank you for a nice package! 👍

haxzorer avatar Aug 21 '20 08:08 haxzorer

Is this the same as #111? @haxzorer did you happen to run with an RTL locale on the server?

khellang avatar Oct 20 '23 12:10 khellang

There's now a forked version with some modernization and bugfixes now on NuGet.org. Hopefully this project will come back to life at some point and the fixes can be accepted upstream 😄

khellang avatar Nov 02 '23 21:11 khellang