You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flagon.apache.org by "Joshua Poore (JIRA)" <ji...@apache.org> on 2019/07/25 01:18:00 UTC

[jira] [Comment Edited] (FLAGON-341) Web Extension Produces Duplicate Logs

    [ https://issues.apache.org/jira/browse/FLAGON-341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16892327#comment-16892327 ] 

Joshua Poore edited comment on FLAGON-341 at 7/25/19 1:17 AM:
--------------------------------------------------------------

Finding: Background and content scripts are interacting. Background script produces browser logs and sends logs directly to useraleHost via sendOnInterval. Content script produces page level logs, adds those logs to background script log queue via browser.runtime.sendMessage (queueLog function). 

Method: added console.log listeners trigger off of ADD_LOG messages from content script. Each log shows the length of the log queue (array; logs.length), and the clientTime for each log.
{code:java}
browser.runtime.onMessage.addListener(function (message) {
  switch (message.type) {
    case CONFIG_CHANGE:
      (function () {
        var updatedConfig = Object.assign({}, config, {
          url: message.payload.userAleHost,
          userId: message.payload.toolUser,
          toolName: message.payload.toolName,
          toolVersion: message.payload.toolVersion
        });
        initSender(logs, updatedConfig);
        console.log("CONFIG_CHANGE" + "_INITsend");
        dispatchTabMessage(message);
      })();
      break;

    case ADD_LOG:
      (function () {
        logs.push(message.payload);
        console.log("ADD_LOG" + "_" + logs.length + "_" + message.payload.clientTime);
      })();
      break;
{code}
Also added console.log to trigger on sendOnInterval (sendLogs) and report log array length.

Results:

!image-2019-07-24-21-11-20-917.png!

Background inspector shows that logs are being added sequentially and then sent according to global parameters. Note undefined are interval logs. Content script is sending multiple copies of logs which are being received by Background. ADD_LOG messages are filling the log queue and sendLogs logs.length fully accounts for ADD_LOG messages + Browserlogs. There is a 1:1 relationship with logs sent via this pipeline and logs received by the logging server.


was (Author: poorejc@me.com):
Finding: Background and content scripts are interacting. Background script produces browser logs and sends logs directly to useraleHost via sendOnInterval. Content script produces page level logs, adds those logs to background script log queue via browser.runtime.sendMessage (queueLog function). 

Method: added console.log listeners trigger off of ADD_LOG messages from content script. Each log shows the length of the log queue (array; logs.length), and the clientTime for each log.
{code:java}
browser.runtime.onMessage.addListener(function (message) {
  switch (message.type) {
    case CONFIG_CHANGE:
      (function () {
        var updatedConfig = Object.assign({}, config, {
          url: message.payload.userAleHost,
          userId: message.payload.toolUser,
          toolName: message.payload.toolName,
          toolVersion: message.payload.toolVersion
        });
        initSender(logs, updatedConfig);
        console.log("CONFIG_CHANGE" + "_INITsend");
        dispatchTabMessage(message);
      })();
      break;

    case ADD_LOG:
      (function () {
        logs.push(message.payload);
        console.log("ADD_LOG" + "_" + logs.length + "_" + message.payload.clientTime);
      })();
      break;
{code}
Also added console.log to trigger on sendOnInterval (sendLogs) and report log array length.

Results:

!image-2019-07-24-21-11-20-917.png!

Background inspector shows that logs are being added sequentially and then sent according to global parameters. Note undefined are interval logs. ADD_LOG messages are filling the log queue and sendLogs logs.length fully accounts for ADD_LOG messages + Browserlogs. There is a 1:1 relationship with logs sent via this pipeline and logs received by the logging server.

> Web Extension Produces Duplicate Logs
> -------------------------------------
>
>                 Key: FLAGON-341
>                 URL: https://issues.apache.org/jira/browse/FLAGON-341
>             Project: Flagon
>          Issue Type: Bug
>          Components: UserALE.js
>    Affects Versions: UserALE.js 2.1.0
>         Environment: Chrome 72
> Firefox 65
> javascript
>            Reporter: Joshua Poore
>            Assignee: Joshua Poore
>            Priority: Major
>             Fix For: UserALE.js 2.1.0
>
>         Attachments: Screen Shot 2019-07-23 at 11.26.58 PM.png, image-2019-07-24-20-59-18-395.png, image-2019-07-24-21-11-20-917.png
>
>
> The Web Extension produces duplicate logs w/ identical class structure and time stamps (incl. microtime).
> Affects 'SENSSOFT-336', '-SENSSOFT-192'- branches, and pre-Gulp 4.0.0 '-SENSSOFT-192'- builds. 
> Affects logs originating from both Firefox and Chrome
> Confirmed that this isn't an indexing problem with Elastic–duplicate logs appear in local file using our example server test utility.
> Confirmed using both temporary 'unpacked' extensions built from source, and pre-build extension on chrome store.
> Behavior noted following upgrade to recent versions of Chrome/Firefox (72/65)
> Confirmed that this behavior DOES NOT affect UserALE.js script tag deployments.
> Confirmed that this behavior originates from browser using java "example" log server (see below).
> {code:java}
> {"target":"div#main-masthead.ui masthead padded center aligned inverted vertical segment","path":["div#main-masthead.ui masthead padded center aligned inverted vertical segment","div.main-wrapper","body","html","#document","Window"],"pageUrl":"http://senssoft.incubator.apache.org/","pageTitle":"Apache SensSoft","pageReferrer":"","clientTime":1553281575226,"microTime":0.73,"location":{"x":288,"y":70},"type":"click","logType":"raw","userAction":true,"details":{"clicks":1,"ctrl":false,"alt":false,"shift":false,"meta":false},"userId":"nobody","toolVersion":null,"toolName":"test_app","useraleVersion":"1.1.0","sessionID":"session_1553280781567"},
> {"target":"div#main-masthead.ui masthead padded center aligned inverted vertical segment","path":["div#main-masthead.ui masthead padded center aligned inverted vertical segment","div.main-wrapper","body","html","#document","Window"],"pageUrl":"http://senssoft.incubator.apache.org/","pageTitle":"Apache SensSoft","pageReferrer":"","clientTime":1553281575226,"microTime":0.73,"location":{"x":288,"y":70},"type":"click","logType":"raw","userAction":true,"details":{"clicks":1,"ctrl":false,"alt":false,"shift":false,"meta":false},"userId":"nobody","toolVersion":null,"toolName":"test_app","useraleVersion":"1.1.0","sessionID":"session_1553280781567"},
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)