Skip to content

fix(analysis): stop a '|' in the Info column from failing analysis (#550)#551

Merged
NotYuSheng merged 2 commits into
mainfrom
fix/pcap-info-pipe-column-shift
Jul 18, 2026
Merged

fix(analysis): stop a '|' in the Info column from failing analysis (#550)#551
NotYuSheng merged 2 commits into
mainfrom
fix/pcap-info-pipe-column-shift

Conversation

@NotYuSheng

Copy link
Copy Markdown
Owner

Problem

Uploading a capture with packets whose _ws.col.Info text contains a literal | fails analysis with "Analysis failed on server." Reproduced with The Ultimate PCAP (FTP passive-mode 229 Entering Extended Passive Mode (|||50076, plus SMTP/SIP/LDAP messages).

Fixes #550.

Root cause

PcapParserService runs tshark with -E separator="|" and splits each line on |. But _ws.col.Info is free text that can itself contain |. When it does, the row gains extra columns and every fixed-index field read after Info is shifted. The fixed read of arp.src.proto_ipv4 (f[16]) then lands on shifted tcp.payload hex (a 96-char string), which flows into arpSrcIp and is inserted into ip_mac_observations.ip (varchar(45)):

ERROR: value too long for type character varying(45)
insert into ip_mac_observations (file_id, ip, mac) values (?,?,?)

That failed insert aborts the Postgres transaction, so every subsequent query returns "current transaction is aborted" and the analysis is marked FAILED.

The trailing fields (frame.number, syn, ack) were already read tail-relative for this exact reason (#496); the middle fields f[12]f[19] were left on fixed indices.

Fix

  • Read all fields emitted after _ws.col.Info tail-relative (they are structured and fixed in count — 11 of them), and reconstruct Info as the middle span (info is a TEXT column, so rejoining is safe).
  • Belt-and-suspenders: cap the ARP-embedded IPs to 45 like srcIp/dstIp, so a malformed value can never abort the transaction again.

No schema change; no API change.

Verification

  • Deterministic (replaying the exact tshark output for the failing capture): across all 49,503 packets the tail-relative arp.src.proto_ipv4 read has max length 15 and 0 rows over 45; the shifted FTP rows realign — correct frame numbers, correct syn/ack, empty ARP fields.
  • End-to-end: re-analysis of the same capture completes (HTTP 200), no errors in backend logs, and ip_mac_observations persists 30 rows with max IP length 15 / max MAC length 17.

🤖 Generated with Claude Code

… Info can't corrupt them (#550)

tshark output is split on '|', but _ws.col.Info is free text that can contain
literal '|' (FTP passive-mode "(|||50076", SMTP/SIP/LDAP messages). A pipe there
adds columns and shifts every fixed-index field after Info. The fixed read of
arp.src.proto_ipv4 (f[16]) then landed on shifted tcp.payload hex, which flowed
into ip_mac_observations.ip (varchar(45)) and overflowed it — aborting the whole
analysis transaction, surfaced in the UI as "Analysis failed on server".

Read all fields after _ws.col.Info tail-relative (they are structured and fixed
in count), matching what was already done for frame.number/syn/ack (#496), and
reconstruct Info as the middle span. Belt-and-suspenders: cap the ARP-embedded
IPs to 45 like srcIp/dstIp.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@NotYuSheng, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 12 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1da27a30-b9e2-4da2-9058-e0e90932aaf3

📥 Commits

Reviewing files that changed from the base of the PR and between 8914294 and bb264d3.

📒 Files selected for processing (1)
  • backend/src/main/java/com/tracepcap/analysis/service/PcapParserService.java

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the PCAP parser to read fields after the _ws.col.Info column relative to the end of the row. This prevents parsing errors and database overflows caused by the '|' separator splitting the free-text Info column. Additionally, embedded ARP IP addresses are capped at 45 characters. The review feedback suggests a performance optimization to avoid StringBuilder allocation when parsing standard rows that do not contain the '|' separator.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread backend/src/main/java/com/tracepcap/analysis/service/PcapParserService.java Outdated
Skip the StringBuilder + rejoin loop for the common case where the Info column
has no embedded '|' (n == 23), assigning f[11] directly. Keeps the per-packet
hot path allocation-free for the vast majority of rows; the rejoin runs only
when Info actually spans multiple columns. (PR #551 review)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@NotYuSheng
NotYuSheng merged commit 2309e00 into main Jul 18, 2026
5 checks passed
@NotYuSheng
NotYuSheng deleted the fix/pcap-info-pipe-column-shift branch July 18, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Analysis fails on captures whose Info column contains '|' (column-shift → varchar overflow)

1 participant