Uploaded image for project: 'Traffic Server'
  1. Traffic Server
  2. TS-4555

C++ API takes a transaction argument without allocating it

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.0.0
    • Component/s: CPP API
    • Labels:
      None

      Description

      Transaction &
      utils::internal::getTransaction(TSHttpTxn ats_txn_handle)
      {
        Transaction *transaction = static_cast<Transaction *>(TSHttpTxnArgGet(ats_txn_handle, TRANSACTION_STORAGE_INDEX));
        if (!transaction) {
          transaction = new Transaction(static_cast<void *>(ats_txn_handle));
          LOG_DEBUG("Created new transaction object at %p for ats pointer %p", transaction, ats_txn_handle);
          TSHttpTxnArgSet(ats_txn_handle, TRANSACTION_STORAGE_INDEX, transaction);
        }
        return *transaction;
      }
      
      

      TRANSACTION_STORAGE_INDEX is hardcoded constant that is not allocated by TSHttpArgIndexReserve, so it is subject to collisions with other plugins.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                amc Alan M. Carroll
                Reporter:
                jamespeach James Peach
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 20m
                  1h 20m