Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding and removing the same view twice causes application to crash #402

Closed
oltionchampari opened this issue Jun 3, 2022 · 5 comments
Closed
Assignees
Labels
priority: high type: bug Something isn't working

Comments

@oltionchampari
Copy link
Contributor

Environment

  • Release number or git hash: develop
  • Browser: chrome
  • Deployed / Local: deployed & local

Steps to reproduce the bug

  1. Open a dataset
  2. Jump to the next view
  3. Select a row
  4. Close view and open it again
  5. Select a row again
  6. Replace the currently open view

Observed Behavior

The application crashes and the views are unresponsive

Expected Behavior

User should be able to replace view

Screenshot

grafik

error

@oltionchampari oltionchampari added type: bug Something isn't working priority: high labels Jun 3, 2022
@thinkh thinkh self-assigned this Jun 3, 2022
@thinkh
Copy link
Member

thinkh commented Jun 15, 2022

I can reproduce this error in my tests. I could even shorten it by omitting the selection in the copy number ranking.

The interesting fact is that only replacing the view (i.e., without add + remove before) works, but with adding and removing it breaks. My assumption is that the ref of the ViewWrapper is created and looked up by a generated static hash. Hence, the object ref is created when adding the first view and gets removed. Then, with the second opening CLUE tries to reuse the previous object ref. However, that ref is not available anymore.

this.ref = ObjectRefUtils.objectRef(this, plugin.desc.name, ObjectRefUtils.category.visual, generateHash(plugin.desc, selection));

I investigate this hypothesis and see if this is the cause.

@thinkh
Copy link
Member

thinkh commented Jun 15, 2022

I extended the generateHash() function by a random hash, to see whether or not the object ref is reused.

function generateHash(desc: IPluginDesc, selection: ISelection) {
  // const s = `${selection.idtype ? selection.idtype.id : ''}r${selection.ids}`;
  const s = `${selection.idtype ? selection.idtype.id : ''}r${selection.ids}_${BaseUtils.randomId()}`;
  return `${desc.id}_${s}`;
}

It turns out that with the random hash replacing the view after add + remove is working successfully! So my initial assumption seems to be confirmed.

ordino-replace-view

Diffing the provenance graphs from before and after the change reveals that the object reference is not reused and the inverse action was added to the graph (which was previously not possible, due to the error within the replace action).

Screenshots

Added random id

image

Successfully added inverse action

image

Reused object ref with id 14 and new object ref with id 21; below the inverse edges

image

image

Exported provenance graphs

Follow-up questions

  1. What (side) effects would the random id in the hash have? Does this change work with existing provenance graphs?
  2. Why is the object ref added in both cases with id 21 (see last diff screenshot), but not used in the case without the random id?
  3. Can we turn off / change the find object ref in CLUE?

@thinkh
Copy link
Member

thinkh commented Jun 15, 2022

  1. Why is the object ref added in both cases with id 21 (see last diff screenshot), but not used in the case without the random id?

The lookup (and reusage) is done in ProvenanceGraph.findInArray() and executed in initAction().

image

Without the random id the same object with id 14 is used from the _objects array.

  1. Can we turn off / change the find object ref in CLUE?

Most likely not. Hence, adding a random id is probably the only solution and we must check the effects as mentioned in question 1.

@thinkh
Copy link
Member

thinkh commented Jun 15, 2022

I check further how and when this bug could have been introduced and I couldn't find any recent change that could cause this error. The existingView variable in the replaceViewImpl is used and also the generate_hash() function hasn't changed (beside using template strings) since the beginning.

Interestingly, the ViewWrapper in tdp_core uses the default hash with ${name}_${category} and creates this.ref with graph.findOrAddObject().

I applied the graph.findOrAddObject() and the generate_hash() without the random id (so original state) to the Ordino ViewWrapper and this also seems to work!

-    this.ref = ObjectRefUtils.objectRef(this, plugin.desc.name, ObjectRefUtils.category.visual, generateHash(plugin.desc, selection));
+    this.ref = graph.findOrAddObject(ObjectRefUtils.objectRef(this, plugin.desc.name, ObjectRefUtils.category.visual, generateHash(plugin.desc, selection)));

ordino-replace-view-findOrAddObject

Screenshots

The interesting point here is that no additional object ref 21 is created and the object ref 14 is reused successfully.

image

All following node ids are decreased by one, due to the missing object ref 21. The screenshot also shows that the replace action was successful by adding the inverse action.

image

image

Exported provenance graphs

@thinkh
Copy link
Member

thinkh commented Jun 15, 2022

I've tested the compatibility with existing provenance graphs, by exporting a session from Ordino Daily (without the ref change) and imported it locally (with the ref change) again. Additionally I've tested the Ordino Paper Teaser Figure. In my tests all actions like add, remove, replace views work without problems. Also jumping to a specific state and the inverse actions work for me.

I also imported the previously broken clue_add-remove-replace-fail.json.txt session and now Ordino continues and finishes the action to replace the view. The graph got extended by the previously missing inverse action. Users could continue that session now.

thinkh added a commit that referenced this issue Jun 15, 2022
Fixes #402

See GitHub issue for in-depth analysis and testing results.
@ghost ghost closed this as completed in 456b054 Aug 4, 2022
ghost pushed a commit that referenced this issue Sep 8, 2022
* prepare next development version 12.0.1-SNAPSHOT

* Fix ref in replace views w/ `findOrAddObject()`

Fixes #402

See GitHub issue for in-depth analysis and testing results.

* Add missing dist files

* Use context to get current view name

Fixes #254

* Remove `nav.mainNavi` styles (#415)

I couldn't find any occurence or usage of the CSS class `mainNavi` in the TypeScript code of the phovea, Caleydo, or datavisyn organization, nor do know where this element would be. Hence, I would remove this code.

* Prepare github changes

* Remove circleci

* prepare next dev version

* Update fontawesome

* refactor: Improve Cypress setup and use Cypress commands.js (#354)

Co-authored-by: Florian Engertsberger <florian.engertsberger@datavisyn.io>
Co-authored-by: Holger Stitz <holger.stitz@datavisyn.io>

* feat: CLUE support for URL query parameter + refactor public session link (#419)

Co-authored-by: oltionchampari <oltion.champari@datavisyn.io>

* Add Visyn Scripts (#421)

* Prepare visyn_script changes

* Update package.json

* Remove prepack script

* Removed phovea_registry.js from package.json files

* Update package.json

* Update package.json

* add depth

* Update package.json

* Update package.json

* Update package.json

* Update package.json

* Update package.json

* Update package.json

* Update engine and prepare script

* Add react resolutions and overrides

* Remove react and react-dom from deps

* add dist folder

* Added resolutions like overrides

* Fix wrongly formatted visyn_scripts git ssh link

* Remove .git from git+ssh link to visyn_script

* Add yarn-3.2.2

* Remove yarn-3.2.2 again

* Add .yarnrc.yml

* Add yarn-3.2.2

* Switch to visyn_scripts clean

* Change d3 to d3v3

Co-authored-by: anita-steiner <>
Co-authored-by: Anita Steiner <anita.steiner@datavisyn.io>
Co-authored-by: Michael Puehringer <michael.puehringer@datavisyn.io>

* Add dist/ folder (#423)

* fix: Replace jQuery scrollTo plugin with custom implementation (#425)

Replace jquery scrollTo plugin with custom impl

* prepare release 13.0.0

Co-authored-by: Holger Stitz <holger.stitz@datavisyn.io>
Co-authored-by: Champari Oltion <51322092+oltionchampari@users.noreply.github.com>
Co-authored-by: Dominic Girardi <45822063+dg-datavisyn@users.noreply.github.com>
Co-authored-by: anita-steiner <>
Co-authored-by: Florian Engertsberger <florian.engertsberger@datavisyn.io>
Co-authored-by: oltionchampari <oltion.champari@datavisyn.io>
Co-authored-by: datavisyn-bot <32451285+datavisyn-bot@users.noreply.github.com>
Co-authored-by: Anita Steiner <anita.steiner@datavisyn.io>
Co-authored-by: Michael Puehringer <michael.puehringer@datavisyn.io>
Co-authored-by: Thomas Schachinger <79898881+dvtschachinger@users.noreply.github.com>
ghost pushed a commit that referenced this issue Sep 30, 2022
* prepare next development version 12.0.1-SNAPSHOT

* Fix ref in replace views w/ `findOrAddObject()`

Fixes #402

See GitHub issue for in-depth analysis and testing results.

* Add missing dist files

* Use context to get current view name

Fixes #254

* Remove `nav.mainNavi` styles (#415)

I couldn't find any occurence or usage of the CSS class `mainNavi` in the TypeScript code of the phovea, Caleydo, or datavisyn organization, nor do know where this element would be. Hence, I would remove this code.

* Prepare github changes

* Remove circleci

* prepare next dev version

* Update fontawesome

* refactor: Improve Cypress setup and use Cypress commands.js (#354)

Co-authored-by: Florian Engertsberger <florian.engertsberger@datavisyn.io>
Co-authored-by: Holger Stitz <holger.stitz@datavisyn.io>

* feat: CLUE support for URL query parameter + refactor public session link (#419)

Co-authored-by: oltionchampari <oltion.champari@datavisyn.io>

* Add Visyn Scripts (#421)

* Prepare visyn_script changes

* Update package.json

* Remove prepack script

* Removed phovea_registry.js from package.json files

* Update package.json

* Update package.json

* add depth

* Update package.json

* Update package.json

* Update package.json

* Update package.json

* Update package.json

* Update package.json

* Update engine and prepare script

* Add react resolutions and overrides

* Remove react and react-dom from deps

* add dist folder

* Added resolutions like overrides

* Fix wrongly formatted visyn_scripts git ssh link

* Remove .git from git+ssh link to visyn_script

* Add yarn-3.2.2

* Remove yarn-3.2.2 again

* Add .yarnrc.yml

* Add yarn-3.2.2

* Switch to visyn_scripts clean

* Change d3 to d3v3

Co-authored-by: anita-steiner <>
Co-authored-by: Anita Steiner <anita.steiner@datavisyn.io>
Co-authored-by: Michael Puehringer <michael.puehringer@datavisyn.io>

* Add dist/ folder (#423)

* fix: Replace jQuery scrollTo plugin with custom implementation (#425)

Replace jquery scrollTo plugin with custom impl

* prepare next dev version

* Improve typings for new session functions (#427)

* Improve typings for new session functions

datavisyn/ordino_eins#525

* Add `await` to `initSessionImpl`

* Add `await` to init session and push view

* Make `pushStartViewToSession` protected

Required to call this function from extended OrdinoApp

* prepare release 13.0.1

Co-authored-by: Holger Stitz <holger.stitz@datavisyn.io>
Co-authored-by: Champari Oltion <51322092+oltionchampari@users.noreply.github.com>
Co-authored-by: Dominic Girardi <45822063+dg-datavisyn@users.noreply.github.com>
Co-authored-by: anita-steiner <>
Co-authored-by: Florian Engertsberger <florian.engertsberger@datavisyn.io>
Co-authored-by: oltionchampari <oltion.champari@datavisyn.io>
Co-authored-by: datavisyn-bot <32451285+datavisyn-bot@users.noreply.github.com>
Co-authored-by: Anita Steiner <anita.steiner@datavisyn.io>
Co-authored-by: Michael Puehringer <michael.puehringer@datavisyn.io>
Co-authored-by: Thomas Schachinger <79898881+dvtschachinger@users.noreply.github.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants