Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-1309

[DefaultDatabaseLocker] Do not log full stack trace when lock cannot be obtained

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 4.1.0
    • AGING_TO_DIE
    • Message Store
    • None

    Description

      In DefaultDatabaseLocker.start(), the locking mechanism uses a continuous retry to obtain the lock. When a given try fails (e.g. because of a lock timeout), then the full exception stack trace is logged. For long-running slave brokers, this results is large, noisy log files full of stack traces, for a condition which is in fact non-exceptional.

      I suggest that this logging is reduced to log just the exception message:

      log.error("Failed to acquire lock: " + e.getMessage();

      Better yet, use Spring's SQLErrorCodeSQLExceptionTranslator to translate the "cannot acquire lock" SQLException into a CannotAcquireLockException, and catch that explicitly in DefaultDatabaseLocker. Then you can just log a message saying "couldn't acquire lock, retrying". Any other exception type can log the full stack trace as before.

      Attachments

        Activity

          People

            Unassigned Unassigned
            skaffman Kenny MacLeod
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: