Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with Track Map Panels #80

Open
amotl opened this issue Nov 7, 2020 · 22 comments
Open

Conflict with Track Map Panels #80

amotl opened this issue Nov 7, 2020 · 22 comments

Comments

@amotl
Copy link

amotl commented Nov 7, 2020

Hi there,

@DmitrySidorow reported about conflicts with Track Map panels at #47 (comment), grafana#283 and pR0Ps/grafana-trackmap-panel#43.

I seems to happen with both [1] and [2] and says TypeError: Cannot read property 'x' of undefined.

image

Can you a) confirm that and b) have a look into the developer tools to see if you are able to get more information about this issue, Dmitry?

With kind regards,
Andreas.

cc @pR0Ps, @j-or, @CodeFunta, @mourner, @IvanSanchez

[1] https://github.com/pR0Ps/grafana-trackmap-panel
[2] https://github.com/alexandrainst/alexandra-trackmap-panel

@amotl
Copy link
Author

amotl commented Nov 7, 2020

On the Leaflet issue tracker, I can find Leaflet/Leaflet#1210, Leaflet/Leaflet#2606 and Leaflet/Leaflet#2607 which might be related. However, all of these have occurred at ~2012-2014 and should well have been mitigated already.

Maybe it's also related to Leaflet/Leaflet#5774 in any way? Similar errors not with the exact same error text can also be found at [3].

[3] https://github.com/Leaflet/Leaflet/search?o=desc&q=Cannot+read+property+%27x%27+of+undefined&type=issues

@amotl amotl changed the title Conflict with Alexandra Track Map Conflict with Track Map Panels Nov 7, 2020
@amotl
Copy link
Author

amotl commented Nov 8, 2020

We should update to the most recent version of Leaflet (see #79) and check if that might resolve this issue.

@grafana-toolbox grafana-toolbox deleted a comment from robouden Nov 8, 2020
@grafana-toolbox grafana-toolbox deleted a comment from robouden Nov 8, 2020
@amotl
Copy link
Author

amotl commented Nov 9, 2020

Dear @DmitrySidorow,

with #81, we will be upgrading to vanilla Leaflet 1.7.1. @robouden has been able to confirm the corresponding pre-release package grafana-map-panel-0.14.0-pre1.zip works for him.

So, I am now humbly asking if you could check this package in your specific environment together with Grafana Track Map [1] and/or Alexandra Track Map [2] to see whether this might resolve the conflict you have been observing?

With kind regards,
Andreas.

@DmitrySidorow
Copy link

DmitrySidorow commented Nov 9, 2020

Dear @DmitrySidorow,

with #81, we will be upgrading to vanilla Leaflet 1.7.1. @robouden has been able to confirm the corresponding pre-release package grafana-map-panel-0.14.0-pre1.zip works for him.

So, I am now humbly asking if you could check this package in your specific environment together with Grafana Track Map [1] and/or Alexandra Track Map [2] to see whether this might resolve the conflict you have been observing?

With kind regards,
Andreas.

issue still exists :(
recorded video:

  1. https://www.youtube.com/watch?v=UIRVn7Jtzkc&feature=youtu.be
  2. https://www.youtube.com/watch?v=-FzqoSFdneE

how can i help you to resolve that?

@DmitrySidorow
Copy link

DmitrySidorow commented Nov 9, 2020

chrome log.log

maybe log from chrome console will help you

Screenshot_1

@amotl
Copy link
Author

amotl commented Nov 9, 2020

Dear Dmitry,

thanks for sharing your investigations.

For whatever reasons, the error might be coming from the intersects method of the Bounds class [1] - specifically from line 1048 [2], which says

xIntersects = (max2.x >= min.x) && (min2.x <= max.x)

So, either min, max, min2 or max2 are undefined here.

This method gets called from the _draw method of the Canvas class [3] - specifically, the culprit is probably line 12341, which says

layer._pxBounds.intersects(bounds)

Without knowing more details yet, the code at one of both places probably should add more sanity checks before operating on the respective Bounds instance.

It looks like Leaflet/Leaflet#5401, Leaflet/Leaflet#6168 and Leaflet/Leaflet#6406 are roughly related to this.

While unrelated to this specific condition, Leaflet/Leaflet#7075 adds more tests for methods of the Bounds class. An eventual pull request should probably do the same, accompanied by improved sanity checks.

With kind regards,
Andreas.

[1] https://github.com/Leaflet/Leaflet/blob/v1.7.1/dist/leaflet-src.js#L1038-L1052
[2] https://github.com/Leaflet/Leaflet/blob/v1.7.1/dist/leaflet-src.js#L1048
[3] https://github.com/Leaflet/Leaflet/blob/v1.7.1/dist/leaflet-src.js#L12327-L12349
[4] https://github.com/Leaflet/Leaflet/blob/v1.7.1/dist/leaflet-src.js#L12341

@amotl
Copy link
Author

amotl commented Nov 9, 2020

It looks like Leaflet/Leaflet#5401, Leaflet/Leaflet#6168 and Leaflet/Leaflet#6406 are roughly related to this.

@anykeyanykey says at Leaflet/Leaflet#6406 (comment):

[We can observe this issue when using] multiple instances of 'leaflet'.

@amotl
Copy link
Author

amotl commented Nov 10, 2020

Dear Dmitry,

I've just also shared your observations at Leaflet/Leaflet#7334.

With kind regards,
Andreas.

@DmitrySidorow
Copy link

noticed:

  1. log in grafana -> grafana-map-panel on start dashboard works good -> go to dashboard with alexandra track map panel -> go to start dashboard: grafana-map-panel breaks
  2. log in grafana -> grafana-map-panel on start dashboard works good -> go to dashboard with alexandra track map panel -> refresh page -> go to start dashboard: grafana-map-panel works good and doesn't break anymore (until the next re-log)

@amotl
Copy link
Author

amotl commented Nov 19, 2020

Dear Dmitry,

thanks for outlining this repro. So, it looks like it is some initialization issue when using Leaflet on different dashboards without clearing the slate by reloading the page.

Can I humbly ask if it also happens the other way round, when going to alexandra track map panel first? Also, does it also happen when navigating to other dashboards without any kind of map and back?

With kind regards,
Andreas.

@DmitrySidorow
Copy link

DmitrySidorow commented Nov 19, 2020

I tried to loading the alexandra track map panel first. But this time nothing broke. From this, we can conclude that the problem is in grafana-map-panel.

@amotl
Copy link
Author

amotl commented Nov 19, 2020

We can conclude that the problem is in grafana-map-panel.

Bummer! ;]. You did use grafana-map-panel-0.14.0-pre1.zip, right?

@DmitrySidorow
Copy link

We can conclude that the problem is in grafana-map-panel.

Bummer! ;]. You did use grafana-map-panel-0.14.0-pre1.zip, right?

yes, 0.14.0-pre1

@amotl
Copy link
Author

amotl commented Nov 19, 2020

All right. Currently, I am out of ideas here. When Leaflet/Leaflet#7334 does not make any progress, I might apply some workarounds to our instance by monkeypatching it.

As I am currently short on time, I humbly ask you for some patience - please ping me again if you don't hear back from me. Thanks for your support!

@DmitrySidorow
Copy link

All right. Currently, I am out of ideas here. When Leaflet/Leaflet#7334 does not make any progress, I might apply some workarounds to our instance by monkeypatching it.

As I am currently short on time, I humbly ask you for some patience - please ping me again if you don't hear back from me. Thanks for your support!

Hello, how's it going? The problem still exists :(
Everything works fine if you do not manually update the page (F5) with the grafana map panel

@amotl
Copy link
Author

amotl commented Feb 11, 2021

Hi Dmitry,

thanks for coming back to this. I am sorry to admit I haven't investigated further. Also, Leaflet seems to be low on developer resources as well. This panel is already using the most recent version 1.7.1. If there will be a new release of Leaflet, I will be happy to integrate it right away.

Nevertheless, I might be able to look into the Monkeypatching when I am back at the code base. Sorry that this causes some pains on your end.

Just to clarify:

Everything works fine if you do not manually update the page (F5) with the grafana map panel.

When watching [1] again, it problem appears when displaying the Map panel on one dashboard, then navigating to another dashboard with Trackmap panel and when navigating back to the Map panel, the circles will not come back, right?

Instead of logging out and logging in again, what would happen if you reload the page by hitting F5?

With kind regards,
Andreas.

P.S.: Are you still using [2] or did you move on to [3]?

[1] https://www.youtube.com/watch?v=UIRVn7Jtzkc
[2] https://github.com/pR0Ps/grafana-trackmap-panel
[3] https://github.com/alexandrainst/alexandra-trackmap-panel

@amotl
Copy link
Author

amotl commented Feb 11, 2021

At #80 (comment), I said:

Maybe it's also related to Leaflet/Leaflet#5774 in any way?

That might also well be an option to investigate further, as this issue with Leaflet is apparently still not completely solved.

@amotl
Copy link
Author

amotl commented Feb 12, 2021

Dear @DmitrySidorow,

Are you still using [2] or did you move on to [3]?

Knowing about this would be helpful if I can catch a slot to rig up a similar setup on my workstation.

With kind regards,
Andreas.

@DmitrySidorow
Copy link

DmitrySidorow commented Feb 12, 2021

Dear @DmitrySidorow,

Are you still using [2] or did you move on to [3]?

Knowing about this would be helpful if I can catch a slot to rig up a similar setup on my workstation.

With kind regards,
Andreas.

I use [3]
You can put both panels in one dashboard to reproduce bug.

@amotl
Copy link
Author

amotl commented Feb 12, 2021

Hi Dmitry,

thanks for letting me know. Now, in order to assist my test rig setup, would you be able to share some parts of your setup by any means? For exporting a subset of the data, InfluxDB Fetcher [1] might come to the rescue (do you actually use InfluxDB?). For Grafana Dashboards, the JSON representation will also be helpful.

@Hualin-AUG just recently shared some bits with me for investigating another issue, see #88. If your setup is more private, you might choose to use a private gist and send the URL through email.

Please note that this is just a humble suggestion how we could work together. If that is not possible, I will completely understand it.

With kind regards,
Andreas.

[1] https://github.com/hgomez/influxdb

@DmitrySidorow
Copy link

Hi Dmitry,

thanks for letting me know. Now, in order to assist my test rig setup, would you be able to share some parts of your setup by any means? For exporting a subset of the data, InfluxDB Fetcher [1] might come to the rescue (do you actually use InfluxDB?). For Grafana Dashboards, the JSON representation will also be helpful.

@Hualin-AUG just recently shared some bits with me for investigating another issue, see #88. If your setup is more private, you might choose to use a private gist and send the URL through email.

Please note that this is just a humble suggestion how we could work together. If that is not possible, I will completely understand it.

With kind regards,
Andreas.

[1] https://github.com/hgomez/influxdb

hi!
I use postgres 12 + timescaledb'
dashboard json:
main.zip

@amotl
Copy link
Author

amotl commented Jan 5, 2023

Hi Dmitry,

apologies that we did not find enough spare time to get into the details of this issue. By chance, the error might have been mitigated on more recent versions of Grafana, Panodata Map Panel, or Trackmap Panel.

Did you have any chance to validate it, or are you still facing this issue?

With kind regards,
Andreas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants