Skip to content

feat(server): log channels held by several IOCs - #191

Merged
anderslindho merged 1 commit into
ChannelFinder:masterfrom
anderslindho:feat/log-shared-channels
Nov 25, 2026
Merged

anderslindho merged 1 commit into
ChannelFinder:masterfrom
anderslindho:feat/log-shared-channels

Conversation

@anderslindho

Copy link
Copy Markdown
Contributor

It is not known how often one channel name is reported by more than one IOC at a site. This happens when two IOCs serve the same PV, or when an IOC is started twice. The RecCeiver already tracks which IOCs hold each channel, but it never reports the overlap.

Each batch that adds names another IOC already holds now logs one warning. Reccaster sends a large upload in batches of up to 5000 records, so one IOC can log several lines and the counts are per batch. The line gives the IOC, the counts, and up to 10 names with the IOCs that hold them. Aliases count when alias is enabled.

The iocid contains the TCP source port, so a restarted IOC gets a new iocid. Until the old disconnect is processed, the new connection overlaps the old one. A holder with the same host and IOC name is therefore counted apart as an earlier connection of the same IOC. An IOC started twice on one host cannot be told apart from this.

@anderslindho anderslindho self-assigned this Nov 17, 2026
@anderslindho
anderslindho force-pushed the feat/log-shared-channels branch 3 times, most recently from 2625a7e to f9d5487 Compare November 18, 2026 09:54

@tynanford tynanford left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This would be useful for debugging. If restarting a IOC causes the overlap, the only concern would be a bunch of warning log statements for a somewhat normal circumstance. Should those cases be log.info instead?

@anderslindho

Copy link
Copy Markdown
Contributor Author

Good point - I'll drop the level to info as you suggest.

A site cannot tell how often one channel name is reported by more than
one IOC. Two IOCs can serve the same PV, or an IOC can be started twice.
The recCeiver tracks which IOCs hold each channel but never reports the
overlap.

The recCeiver now logs one warning for each batch that adds names
another IOC already holds. The line gives the IOC, the counts, and up to
10 names with the IOCs that hold them. Reccaster uploads in batches of
up to 5000 records, so a large IOC can log several lines, each with the
counts for its batch. Aliases count if `alias` is enabled.

A restarted IOC gets a new `iocid`, because the `iocid` contains the TCP
source port. The new connection overlaps the old one until the old
disconnect is processed. A holder with the same host and IOC name is
therefore counted separately, as an earlier connection of the same IOC.
An IOC started twice on one host looks the same and is counted that way
too.
@anderslindho
anderslindho force-pushed the feat/log-shared-channels branch from f9d5487 to 69bba2e Compare November 20, 2026 10:05
@sonarqubecloud

Copy link
Copy Markdown

@anderslindho

Copy link
Copy Markdown
Contributor Author

Fixed. Note, however, that the default loglevel is WARN, so the restart line is not shown at all unless the level is lowered. An IOC started twice on the same host looks the same as a restart and is hidden the same way.

@shroffk

shroffk commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

ChannelFinder/ChannelFinderService#259

This is based on the discussions at the codeathon.

@anderslindho

Copy link
Copy Markdown
Contributor Author

@shroffk did you mean #259 should replace this one, or was it just FYI?

My thinking is that this remains useful on its own. On by default, lists which IOCs hold each name, and now differentiates restarted IOC from different IOC.

@shroffk

shroffk commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Let us just treat it as FYI.

For our setup I don't need the recciever to do the checks when the same checks can be done by CF without moving all the channels back and forth over the network.

On by default, lists which IOCs hold each name, and now differentiates restarted IOC from different IOC.

The current check has all the existing properties (hostname, iocname, iocid ,etc.. )

o.p.c.p.v.ActiveChannelPreProcessor :
 Channel 'TST{IOC:ioccf-perf-01}L100:STR:0999': Channel already exists and is active (pvStatus=Active); 
 changes: 
 iocName: 62537 -> 60561,
 time: 2026-11-23T10:27:27.607161500-05:00 -> 2026-11-23T10:28:52.244455700-05:00,
 iocid: 127.0.0.1:62537 -> 127.0.0.1:60561, 
 caPort: 5064 -> 60556

Is there additional information in recciever which is not there in CF?
I would guess that whatever validation logic we figure out to identify restarted/moved IOCs... we should be able to adopt the same on the CF side. The host, iocName, iocid, etc...are all available so we could add this same checks.

Anyway, we can merge this since I am not planning on using cfstore anyway :)

@anderslindho

Copy link
Copy Markdown
Contributor Author

Is there additional information in recciever which is not there in CF?

recCeiver holds and has info from both/all open connections while CF (currently?) only can see current vs new data/metadata, so recCeiver can - if we want it to - provide more info about the "duplicate(s)" and their sources.

Side note on your log: iocName shows 62537 -> 60561, i.e. the port. If that is how iocName is set in that test, a same-name check in CF would count every restart as a different IOC.

@anderslindho
anderslindho merged commit ab98a27 into ChannelFinder:master Nov 25, 2026
15 checks passed
@shroffk

shroffk commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

recCeiver holds and has info from both/all open connections while CF (currently?) only can see current vs new data/metadata, so recCeiver can - if we want it to - provide more info about the "duplicate(s)" and their sources.

The open connections should map to pvStatus, if it is active then it indicates the IOC and a recciever have an open connection... when this connection is gone then the PV should be marked Unknown. So I am still not sure I understand what additional information is there in the recciever.

If two IOC's are started with the same PV's then the validators should trigger the "duplicate" warnings.

The env variable iocName on my test is not setup... I am sure the production setup will not have this problem

@anderslindho

Copy link
Copy Markdown
Contributor Author

My point was that you asked if recCeiver has information that CF does not, and I answered that yeah, it can hold several connections that all claim to publish the same PV name. Open connections don't map to pvStatus. pvStatus is one value per channel in CF, and CF only ever sees current and new for any of those channels. recCeiver sees all the connections.

Side point, but "Unknown" for pvStatus is also really strange to me. If Inactive already means the connection is gone, then all Inactive can be considered Unknown and we're back to two states.

@shroffk

shroffk commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

it can hold several connections that all claim to publish the same PV name.

Ah, I see now, you are right... the above would be true with a single recciever setup ( might not be as useful if you have multiple subnets/reccievers? )

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.

3 participants