Skip to content

Fix Visual Explain view crashing on multi-parents nodes#489

Open
sebjulliand wants to merge 6 commits intomainfrom
fixVEMultiParentNodes
Open

Fix Visual Explain view crashing on multi-parents nodes#489
sebjulliand wants to merge 6 commits intomainfrom
fixVEMultiParentNodes

Conversation

@sebjulliand
Copy link
Member

Description

Fixes #423

This PR fixes an issue making the Visual Explain treeview crash as described in #423.
The logic used to link nodes with each others was flawed as it did not use the child node information returned by Visual Explain. This could work as long as each node had one and only one parent. But if one or more nodes have multiple parents, it would crash.

With this PR, nodes are linked together using the children node ids returned by Visual Explain.

How to test

Run Explain (without running is fine) using a query producing a graph with nodes having multiple parents, like the one provided in #423:

WITH ip_addrs(rmt_addr, rmt_count)
   AS (SELECT remote_address, COUNT(*)
          FROM TABLE(qsys2.display_journal('QSYS', 'QAUDJRN',
             journal_entry_types => 'PW', starting_timestamp => CURRENT
             TIMESTAMP - 24 HOURS)) AS x
          GROUP BY remote_address)
   SELECT i.rmt_addr, i.rmt_count, user_name, rmt_port
      FROM ip_addrs i LEFT OUTER JOIN 
      qsys2.netstat_job_info n ON i.rmt_addr = remote_address 
union all     
   SELECT i.rmt_addr, i.rmt_count, user_name, rmt_port
      FROM ip_addrs i LEFT OUTER JOIN 
      qsys2.netstat_job_info n ON i.rmt_addr = remote_address 

union all     
   SELECT i.rmt_addr, i.rmt_count, user_name, rmt_port
      FROM ip_addrs i LEFT OUTER JOIN 
      qsys2.netstat_job_info n ON i.rmt_addr = remote_address 
image

Before the PR, the VE view would show the this.flatNodes[node.id] is not iterable error.
With the PR applied, the graph must be displayed correctly.
image

Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
@sebjulliand sebjulliand requested a review from a team January 19, 2026 16:05
@sebjulliand sebjulliand self-assigned this Jan 19, 2026
@sebjulliand sebjulliand added the bug Something isn't working label Jan 19, 2026
@github-actions
Copy link

github-actions bot commented Jan 19, 2026

👋 A new build is available for this PR based on f23d4cd.

@sebjulliand sebjulliand mentioned this pull request Jan 19, 2026
9 tasks
@SanjulaGanepola
Copy link
Member

SanjulaGanepola commented Jan 30, 2026

@sebjulliand Explain without running worked fine for that example, but looks like when I do Run and explain statement I don't get any visual explain result. I noticed this when I enabled Caught Exceptions. I'm still learning this code for like the first time and trying to understand the VE data structure, so couldn't find exactly what went wrong.
image

@sebjulliand
Copy link
Member Author

@SanjulaGanepola I ran a slightly modified query (I couldn't run the original one on the LPARs I had).
Does it crash for you with this one too? (it did not for me).

WITH ip_addrs(rmt_addr, rmt_count)
   AS (SELECT remote_address, COUNT(*)
          FROM QSYS2.netstat_info AS x
          GROUP BY remote_address)
   SELECT i.rmt_addr, i.rmt_count, user_name, rmt_port
      FROM ip_addrs i LEFT OUTER JOIN 
      qsys2.netstat_job_info n ON i.rmt_addr = remote_address 
union all     
   SELECT i.rmt_addr, i.rmt_count, user_name, rmt_port
      FROM ip_addrs i LEFT OUTER JOIN 
      qsys2.netstat_job_info n ON i.rmt_addr = remote_address 

union all     
   SELECT i.rmt_addr, i.rmt_count, user_name, rmt_port
      FROM ip_addrs i LEFT OUTER JOIN 
      qsys2.netstat_job_info n ON i.rmt_addr = remote_address

@sebjulliand
Copy link
Member Author

@SanjulaGanepola as far as I could tell, while working on this fix, the VE data structure is comprised on many rows returned by a request. Each row is a line of information for a node. So the code loops over each row to recompose each node (each row has a node id).
And then, links between nodes is given by the childrenNode field on each parent node.
The delta processing thing indicates an information that spreads across multiple rows. I'd be curious to know if your error also happens without the PR 🤔

@SanjulaGanepola
Copy link
Member

@sebjulliand I just gave every case a try again:

Main branch with the original query:

  • Run and explain statement: No VE view shown
  • Explain without running: this.flatNodes[node.id] is not iterable

Main branch with the #489 (comment) query:

  • Run and explain statement: No VE view shown
  • Explain without running: this.flatNodes[node.id] is not iterable

This branch with the original query:

  • Run and explain statement: No VE view shown
  • Explain without running: Works

This branch with the #489 (comment) query:

  • Run and explain statement: Works
  • Explain without running: Works

@sebjulliand
Copy link
Member Author

I could reproduce the problem and the data returned by VE don't make sense.
image
This trigger the delta processing on node 1.
But the following two data rows have no title, and the TEST value.
image

Since the title is and not an actual empty string, the data isn't skipped:
image

Maybe skipping it could fix this...I'll try it later.

Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
@sebjulliand
Copy link
Member Author

@SanjulaGanepola I guess that bug existed since...forever.

I pushed a fix and so far, the results seem OK. I added a check to prevent the process from crashing in case an attribute is not found while processing delta.

I also compared the values being replaced during delta processing and they were either unknown or the same as the value replacing them.

I'll let you have a look and validate it 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

this.flatNodes[node.id] is not iterable

2 participants