Uploaded image for project: 'Chukwa'
  1. Chukwa
  2. CHUKWA-574

Multiple metrics emite at the same time causes logger to print corrupted metrics

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.5.0
    • Component/s: Input Tools
    • Labels:
      None
    • Environment:

      Java 6, Mac OS X 10.6

      Description

      Log4JMetricsContext only has synchronized locks to initialize the logger. When they are multiple threads trying to emite metrics, there is a slight possibility that the output of multiple metrics written as one log entry. Synchronized locks should apply for the whole emiteRecord method.

        Activity

        Hide
        eyang Eric Yang added a comment -

        Modify the synchronized block to cover the entire emiteRecord method.

        Show
        eyang Eric Yang added a comment - Modify the synchronized block to cover the entire emiteRecord method.
        Hide
        asrabkin Ari Rabkin added a comment -

        Good catch. Did this come up in operation?

        Show
        asrabkin Ari Rabkin added a comment - Good catch. Did this come up in operation?
        Hide
        eyang Eric Yang added a comment -

        Yes. The log line was showing someting like:

        2011-01-01 21:13:47,517 [main] INFO { ... 2011-01-01 21:14:47,517 [main] INFO

        { ... }

        }

        After the patch, it seems to work correctly.

        Show
        eyang Eric Yang added a comment - Yes. The log line was showing someting like: 2011-01-01 21:13:47,517 [main] INFO { ... 2011-01-01 21:14:47,517 [main] INFO { ... } } After the patch, it seems to work correctly.
        Hide
        eyang Eric Yang added a comment -

        Thanks Ari, I just committed this.

        Show
        eyang Eric Yang added a comment - Thanks Ari, I just committed this.

          People

          • Assignee:
            eyang Eric Yang
            Reporter:
            eyang Eric Yang
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development