billmurrin / graylog-plugin-quickvaluesplus-widget

GrayLog2 QuickValuesPlus Widget
GNU General Public License v3.0
22 stars 3 forks source link

[Bug] QuickValues causes search page query button to break autoreload #26

Closed pbr0ck3r closed 7 years ago

pbr0ck3r commented 7 years ago

GL- 2.3.1 QV - 3.0.0

Get the following stack trace in the browser console when on the search page and clicking the green search button for a query. Breaks updating page

Uncaught TypeError: Cannot read property 'top_values' of null
    at t._loadQuickValuesData (plugin.org.graylog.plugins.quickvaluesplus.QuickValuesPlusWidgetPlugin.31b1aa7471d3b7c9e86b.js:104)
    at t.componentWillReceiveProps (plugin.org.graylog.plugins.quickvaluesplus.QuickValuesPlusWidgetPlugin.31b1aa7471d3b7c9e86b.js:104)
    at p.updateComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at p.i [as updateComponent] (vendor.294ee71193d2aeb18bc5.js:6)
    at p.receiveComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at Object.receiveComponent (vendor.294ee71193d2aeb18bc5.js:6)
    at Object.updateChildren (vendor.294ee71193d2aeb18bc5.js:20)
    at v._reconcilerUpdateChildren (vendor.294ee71193d2aeb18bc5.js:20)
    at v._updateChildren (vendor.294ee71193d2aeb18bc5.js:20)
    at v.updateChildren (vendor.294ee71193d2aeb18bc5.js:20)
    at v._updateDOMChildren (vendor.294ee71193d2aeb18bc5.js:20)
    at v.updateComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at v.receiveComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at Object.receiveComponent (vendor.294ee71193d2aeb18bc5.js:6)
    at p._updateRenderedComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at p._performComponentUpdate (vendor.294ee71193d2aeb18bc5.js:20)
    at p.updateComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at p.i [as updateComponent] (vendor.294ee71193d2aeb18bc5.js:6)
    at p.receiveComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at Object.receiveComponent (vendor.294ee71193d2aeb18bc5.js:6)
    at Object.updateChildren (vendor.294ee71193d2aeb18bc5.js:20)
    at v._reconcilerUpdateChildren (vendor.294ee71193d2aeb18bc5.js:20)
    at v._updateChildren (vendor.294ee71193d2aeb18bc5.js:20)
    at v.updateChildren (vendor.294ee71193d2aeb18bc5.js:20)
    at v._updateDOMChildren (vendor.294ee71193d2aeb18bc5.js:20)
    at v.updateComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at v.receiveComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at Object.receiveComponent (vendor.294ee71193d2aeb18bc5.js:6)
    at p._updateRenderedComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at p._performComponentUpdate (vendor.294ee71193d2aeb18bc5.js:20)
    at p.updateComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at p.i [as updateComponent] (vendor.294ee71193d2aeb18bc5.js:6)
    at p.receiveComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at Object.receiveComponent (vendor.294ee71193d2aeb18bc5.js:6)
    at p._updateRenderedComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at p._performComponentUpdate (vendor.294ee71193d2aeb18bc5.js:20)
    at p.updateComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at p.i [as updateComponent] (vendor.294ee71193d2aeb18bc5.js:6)
    at p.receiveComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at Object.receiveComponent (vendor.294ee71193d2aeb18bc5.js:6)
    at p._updateRenderedComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at p._performComponentUpdate (vendor.294ee71193d2aeb18bc5.js:20)
    at p.updateComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at p.i [as updateComponent] (vendor.294ee71193d2aeb18bc5.js:6)
    at p.receiveComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at Object.receiveComponent (vendor.294ee71193d2aeb18bc5.js:6)
    at p._updateRenderedComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at p._performComponentUpdate (vendor.294ee71193d2aeb18bc5.js:20)
    at p.updateComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at p.i [as updateComponent] (vendor.294ee71193d2aeb18bc5.js:6)
    at p.receiveComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at Object.receiveComponent (vendor.294ee71193d2aeb18bc5.js:6)
    at p._updateRenderedComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at p._performComponentUpdate (vendor.294ee71193d2aeb18bc5.js:20)
    at p.updateComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at p.i [as updateComponent] (vendor.294ee71193d2aeb18bc5.js:6)
    at p.receiveComponent (vendor.294ee71193d2aeb18bc5.js:20)
    at Object.receiveComponent (vendor.294ee71193d2aeb18bc5.js:6)
    at Object.updateChildren (vendor.294ee71193d2aeb18bc5.js:20)
    at v._reconcilerUpdateChildren (vendor.294ee71193d2aeb18bc5.js:20)
    at v._updateChildren (vendor.294ee71193d2aeb18bc5.js:20)
    at v.updateChildren (vendor.294ee71193d2aeb18bc5.js:20)
    at v._updateDOMChildren (vendor.294ee71193d2aeb18bc5.js:20)
    at v.updateComponent (vendor.294ee71193d2aeb18bc5.js:20)
pbr0ck3r commented 7 years ago

See this every time I click the query button. Whether I add query params or not in the search field

pbr0ck3r commented 7 years ago

I believe this is still a issue. But have found that the page not autorefreshing is due to bluebird.js which is used by graylog. It is used when selecting a save query to autofill the search field (coming from the aggregates plugin graylog offers)

billmurrin commented 7 years ago

Thanks for the information. This seems related to the other issue as well. What OS are you using and which browser if you don't mind me asking.

pbr0ck3r commented 7 years ago

Mac OS 10.12.6 (Sierra) Chrome

billmurrin commented 7 years ago

I packaged a version with a few additional console.log commands and a couple changes, can you run this version, try to recreate the event and then provide the logs. Thanks.

https://www.dropbox.com/s/om256jky1bwnt2v/graylog-plugin-quickvaluesplus-widget-3.0.0.jar?dl=0

pbr0ck3r commented 7 years ago

@billmurrin Ran the custom jar in my environment and here is the error log.

Uncaught TypeError: Cannot read property 'top_values' of null
    at t._loadQuickValuesData (FieldQuickValuesPlus.jsx:93)
    at t.componentWillReceiveProps (FieldQuickValuesPlus.jsx:66)
    at p.updateComponent (vendor.294ee71….js:20)
    at p.i [as updateComponent] (vendor.294ee71….js:6)
    at p.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at Object.updateChildren (vendor.294ee71….js:20)
    at v._reconcilerUpdateChildren (vendor.294ee71….js:20)
    at v._updateChildren (vendor.294ee71….js:20)
    at v.updateChildren (vendor.294ee71….js:20)
    at v._updateDOMChildren (vendor.294ee71….js:20)
    at v.updateComponent (vendor.294ee71….js:20)
    at v.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at p._updateRenderedComponent (vendor.294ee71….js:20)
    at p._performComponentUpdate (vendor.294ee71….js:20)
    at p.updateComponent (vendor.294ee71….js:20)
    at p.i [as updateComponent] (vendor.294ee71….js:6)
    at p.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at Object.updateChildren (vendor.294ee71….js:20)
    at v._reconcilerUpdateChildren (vendor.294ee71….js:20)
    at v._updateChildren (vendor.294ee71….js:20)
    at v.updateChildren (vendor.294ee71….js:20)
    at v._updateDOMChildren (vendor.294ee71….js:20)
    at v.updateComponent (vendor.294ee71….js:20)
    at v.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at p._updateRenderedComponent (vendor.294ee71….js:20)
    at p._performComponentUpdate (vendor.294ee71….js:20)
    at p.updateComponent (vendor.294ee71….js:20)
    at p.i [as updateComponent] (vendor.294ee71….js:6)
    at p.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at p._updateRenderedComponent (vendor.294ee71….js:20)
    at p._performComponentUpdate (vendor.294ee71….js:20)
    at p.updateComponent (vendor.294ee71….js:20)
    at p.i [as updateComponent] (vendor.294ee71….js:6)
    at p.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at p._updateRenderedComponent (vendor.294ee71….js:20)
    at p._performComponentUpdate (vendor.294ee71….js:20)
    at p.updateComponent (vendor.294ee71….js:20)
    at p.i [as updateComponent] (vendor.294ee71….js:6)
    at p.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at p._updateRenderedComponent (vendor.294ee71….js:20)
    at p._performComponentUpdate (vendor.294ee71….js:20)
    at p.updateComponent (vendor.294ee71….js:20)
    at p.i [as updateComponent] (vendor.294ee71….js:6)
    at p.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at p._updateRenderedComponent (vendor.294ee71….js:20)
    at p._performComponentUpdate (vendor.294ee71….js:20)
    at p.updateComponent (vendor.294ee71….js:20)
    at p.i [as updateComponent] (vendor.294ee71….js:6)
    at p.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at Object.updateChildren (vendor.294ee71….js:20)
    at v._reconcilerUpdateChildren (vendor.294ee71….js:20)
    at v._updateChildren (vendor.294ee71….js:20)
    at v.updateChildren (vendor.294ee71….js:20)
    at v._updateDOMChildren (vendor.294ee71….js:20)
    at v.updateComponent (vendor.294ee71….js:20)
billmurrin commented 7 years ago

Can you try to download it again - made a few other tweaks.

It seems almost like your cache wasn't cleared as line 93 is the offending line from the release version, the debug statements would move the offending code lower than 93.

After you put the jar in your plugin directory and restart Graylog server, can you force refresh (Cntrl + F5) or clear your cache and reload the page.

BTW, thanks for your help testing, I've been unable to recreate the event locally.

pbr0ck3r commented 7 years ago

@billmurrin So I realized I moved a old copy I had on my machine and not your debug version so my bad! Also you are welcome for the help with testing!

18:07:05.710 FieldQuickValuesPlus.jsx:53 In componentDidMount
18:07:05.713 FieldQuickValuesPlus.jsx:99 Global Configuration value is
18:07:05.713 FieldQuickValuesPlus.jsx:100 undefined
18:07:05.713 FieldQuickValuesPlus.jsx:102 Is loaded: false
18:07:05.714 FieldQuickValuesPlus.jsx:117 Global config not loaded. QVP Options using internal default values.
18:07:05.714 FieldQuickValuesPlus.jsx:130 QVP Options - _loadQuickValuesData
18:07:05.716 FieldQuickValuesPlus.jsx:131 Object {top_values: 5, sort_order: "descending", table_size: 25, show_pie_chart: true, show_data_table: true}
18:07:15.115 FieldQuickValuesPlus.jsx:99 Global Configuration value is
18:07:15.118 FieldQuickValuesPlus.jsx:100 Object {org.graylog.plugins.quickvaluesplus.QuickValuesPlusPluginConfiguration: null}
18:07:15.120 FieldQuickValuesPlus.jsx:102 Is loaded: false
18:07:15.123 FieldQuickValuesPlus.jsx:105 Global config loaded. QVP Options using global configuration settings.
18:07:15.178 FieldQuickValuesPlus.jsx:99 Global Configuration value is
18:07:15.179 FieldQuickValuesPlus.jsx:100 Object {org.graylog.plugins.quickvaluesplus.QuickValuesPlusPluginConfiguration: null}
18:07:15.181 FieldQuickValuesPlus.jsx:102 Is loaded: false
18:07:15.183 FieldQuickValuesPlus.jsx:105 Global config loaded. QVP Options using global configuration settings.
18:07:15.185 FieldQuickValuesPlus.jsx:108 Uncaught TypeError: Cannot read property 'top_values' of null
    at t._loadQuickValuesData (FieldQuickValuesPlus.jsx:108)
    at t.componentWillReceiveProps (FieldQuickValuesPlus.jsx:72)
    at p.updateComponent (vendor.294ee71….js:20)
    at p.i [as updateComponent] (vendor.294ee71….js:6)
    at p.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at Object.updateChildren (vendor.294ee71….js:20)
    at v._reconcilerUpdateChildren (vendor.294ee71….js:20)
    at v._updateChildren (vendor.294ee71….js:20)
    at v.updateChildren (vendor.294ee71….js:20)
    at v._updateDOMChildren (vendor.294ee71….js:20)
    at v.updateComponent (vendor.294ee71….js:20)
    at v.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at p._updateRenderedComponent (vendor.294ee71….js:20)
    at p._performComponentUpdate (vendor.294ee71….js:20)
    at p.updateComponent (vendor.294ee71….js:20)
    at p.i [as updateComponent] (vendor.294ee71….js:6)
    at p.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at Object.updateChildren (vendor.294ee71….js:20)
    at v._reconcilerUpdateChildren (vendor.294ee71….js:20)
    at v._updateChildren (vendor.294ee71….js:20)
    at v.updateChildren (vendor.294ee71….js:20)
    at v._updateDOMChildren (vendor.294ee71….js:20)
    at v.updateComponent (vendor.294ee71….js:20)
    at v.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at p._updateRenderedComponent (vendor.294ee71….js:20)
    at p._performComponentUpdate (vendor.294ee71….js:20)
    at p.updateComponent (vendor.294ee71….js:20)
    at p.i [as updateComponent] (vendor.294ee71….js:6)
    at p.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at p._updateRenderedComponent (vendor.294ee71….js:20)
    at p._performComponentUpdate (vendor.294ee71….js:20)
    at p.updateComponent (vendor.294ee71….js:20)
    at p.i [as updateComponent] (vendor.294ee71….js:6)
    at p.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at p._updateRenderedComponent (vendor.294ee71….js:20)
    at p._performComponentUpdate (vendor.294ee71….js:20)
    at p.updateComponent (vendor.294ee71….js:20)
    at p.i [as updateComponent] (vendor.294ee71….js:6)
    at p.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at p._updateRenderedComponent (vendor.294ee71….js:20)
    at p._performComponentUpdate (vendor.294ee71….js:20)
    at p.updateComponent (vendor.294ee71….js:20)
    at p.i [as updateComponent] (vendor.294ee71….js:6)
    at p.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at p._updateRenderedComponent (vendor.294ee71….js:20)
    at p._performComponentUpdate (vendor.294ee71….js:20)
    at p.updateComponent (vendor.294ee71….js:20)
    at p.i [as updateComponent] (vendor.294ee71….js:6)
    at p.receiveComponent (vendor.294ee71….js:20)
    at Object.receiveComponent (vendor.294ee71….js:6)
    at Object.updateChildren (vendor.294ee71….js:20)
    at v._reconcilerUpdateChildren (vendor.294ee71….js:20)
    at v._updateChildren (vendor.294ee71….js:20)
    at v.updateChildren (vendor.294ee71….js:20)
    at v._updateDOMChildren (vendor.294ee71….js:20)
    at v.updateComponent (vendor.294ee71….js:20)
billmurrin commented 7 years ago

Can you go into the Global Configuration and tell me if you see values for the Quick Values Plus Plugin?

Can you please configure some, save the changes, and then see if the error happens.

pbr0ck3r commented 7 years ago

Yes I do have values for the global configuration:

Number of Top Values: 5 Size of Table: 50 Sort Order: Descending

Changed Top Values to 7. Here is the new logs. On page load

In componentWillMount
18:22:00.379 FieldQuickValuesPlus.jsx:53 In componentDidMount
18:22:00.380 FieldQuickValuesPlus.jsx:99 Global Configuration value is
18:22:00.381 FieldQuickValuesPlus.jsx:100 undefined
18:22:00.382 FieldQuickValuesPlus.jsx:102 Is loaded: false
18:22:00.382 FieldQuickValuesPlus.jsx:117 Global config not loaded. QVP Options using internal default values.
18:22:00.383 FieldQuickValuesPlus.jsx:130 QVP Options - _loadQuickValuesData
18:22:00.383 FieldQuickValuesPlus.jsx:131 Object {top_values: 5, sort_order: "descending", table_size: 25, show_pie_chart: true, show_data_table: true}

After search once...

Global Configuration value is
18:23:35.726 FieldQuickValuesPlus.jsx:100 Object {org.graylog.plugins.quickvaluesplus.QuickValuesPlusPluginConfiguration: Object}
18:23:35.728 FieldQuickValuesPlus.jsx:102 Is loaded: false
18:23:35.730 FieldQuickValuesPlus.jsx:105 Global config loaded. QVP Options using global configuration settings.
18:23:35.731 FieldQuickValuesPlus.jsx:130 QVP Options - _loadQuickValuesData
18:23:35.733 FieldQuickValuesPlus.jsx:131 Object {top_values: 5, sort_order: "descending", table_size: 25, show_pie_chart: true, show_data_table: true}

After searching twice it changed...

Global Configuration value is
18:23:47.953 FieldQuickValuesPlus.jsx:100 Object {org.graylog.plugins.quickvaluesplus.QuickValuesPlusPluginConfiguration: Object}
18:23:47.955 FieldQuickValuesPlus.jsx:102 Is loaded: true
18:23:47.957 FieldQuickValuesPlus.jsx:130 QVP Options - _loadQuickValuesData
18:23:47.959 FieldQuickValuesPlus.jsx:131 Object {top_values: 7, sort_order: "descending", table_size: 50, show_pie_chart: true, show_data_table: true}

Not stack trace

billmurrin commented 7 years ago

So you are no longer getting the error?

I think I've narrowed down the problem to setting the Default Config for the widget. Will work on resolution of that.

The values you see in the Configuration page are not necessary persisted on the MongoDB side of things... yet. :-)

Thanks again for your help.

pbr0ck3r commented 7 years ago

No longer getting error logs. Glad I can help. I do have a local graylog environment in intellij running graylog 2.3.1 but was unable to get the quick-values-widget to load as a module. Kept getting webpack errors about react, react-dom, d3, etc. But I could get the widget to work if I compiled it and added it to my plugin folder locally. When graylog was still 2.2/2.3 I could load it just fine locally without having to compile it.

Here to help all I can! As I working on some graylog updates and plugins myself for the community as my company has strong ties with the graylog developers.

billmurrin commented 7 years ago

Just released version 3.0.1. Added the necessary migration for the initial plugin defaults. Thanks for your help.

I'm using IntelliJ as well, but typically just import the POM and work with it that way. If you npm install on the plugin directory, does it get rid of the webpack errors?

pbr0ck3r commented 7 years ago

Version 3.0.1 works great! Also was able to get the plugin working in my developer environment. I believe I had a bad state of web pack or something (some missing libraries). Just did a clean install of the environment and that seem to work. No more webpack saying missing 'react', 'react-dom', 'd3', etc.