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

unbounded memory usage in unyielding JS jobs creating ObjectWrap-ed native objects #1140

Closed
MichaelBelousov opened this issue Feb 22, 2022 · 11 comments

Comments

@MichaelBelousov
Copy link

MichaelBelousov commented Feb 22, 2022

See this minimal reproduction repository.

When creating several instances of a C++ object that is wrapped by ObjectWrap, memory usage goes up forever unless the JavaScript job yields. Even though the JavaScript object is garbage collected and the JS heap size is stable. According to heaptrack, suspicious allocations are occurring in napi_wrap whenever the ObjectWrap is created. I based the C++ addon on this documentation.

Clone the above repo and run:

npm install # for node-addon-api and node-gyp dependencies
npm run build # C++ build
node ./index.js

here is the loop in the minimal repro:

for (let i = 0; i < MAX_ITERS; ++i) {
  const nativeObj = NativeObj.create();
  // uncomment this and the application will not leak
  // await new Promise(setImmediate);
}

On my Ubuntu 21.10 machine with Node.js 17.5, process.memoryUsage().rss stabilizes at ~103MB
if yielding by uncommenting the await new Promise(setImmediate) line.
Otherwise it goes up until the process is killed for eating too much memory.

Is this a memory leak? It does affect a larger addon from which I created the sample loop.

Running node with --trace_gc and tracking the JavaScript heap, external, and buffer sizes demonstrate that the process memory growth is not from there, and that full mark-sweep garbage collections are occurring in parallel.

MichaelBelousov added a commit to iTwin/itwinjs-core that referenced this issue Feb 22, 2022
- see this issue report of the leak nodejs/node-addon-api#1140
- the leak appears to be a bug in node[-addon-api]. Tracing the gc shows JS heap size remains stable and old-generation garbage collection sweeps occur in parallel with the JS work, but objects that use `Napi::ObjectWrap` hold on to some memory until the thread yields. See the above issue for more details.
- the workaround is to force yield the javascript job in long loops
- the transformation service already employs this workaround to handle huge models

Co-authored-by: Michael Belousov <[email protected]>
@gabrielschulhof
Copy link
Contributor

@vmoroz suggested that a possible way out is to manage our queue of finalizers ourselves, and to add an epilogue to each napi_* and node_api_* function that drains the queue. We already have such a queue of finalizers, because we drain it at environment shutdown. Some interesting avenues to explore:

  • What are the performance changes if we do add such an epilogue?
  • Can we simply drain the existing queue of finalizers (the one we drain during environment shutdown) as part of the epilogue?
  • Can we add a reasonable heuristic to only delete some of the items during epilogue, in case we find that sometimes very many of these accumulate?

@MichaelBelousov this is a known issue, and arises from the fact that we cannot synchronously free native memory during garbage collection, because freeing something on the native side may result in JavaScript getting executed, which cannot be done during garbage collection, because the engine is not in the right state for executing JavaScript. The only workaround currently is to design the code to basically "pace itself" when creating many objects.

@MichaelBelousov
Copy link
Author

@gabrielschulhof is there a better workaround? Is there a way to manually drain the queue in the addon? Or is the best thing really to split up the execution (await new Promise(setImmediate)) on the javascript end like I suggested?

@vmoroz
Copy link
Member

vmoroz commented Feb 25, 2022

@gabrielschulhof is there a better workaround? Is there a way to manually drain the queue in the addon? Or is the best thing really to split up the execution (await new Promise(setImmediate)) on the javascript end like I suggested?

Per our discussion today it does not seem that we have a better workaround today than awaiting Promises in the code. We assume that the finalizers to delete native code are run as micro-tasks. The same micro-task queue that is used for Promises.
There is no ABI-safe API to drain the micro-task queue inside of the addons. Even if we would have one, it could cause some unexpected side-effects because there can be other tasks besides object finalizers.

I believe that in future we can address this issue with the dedicated finalizer queue, but it is difficult to give any prediction if such change will be accepted and when it will be accepted. I used this approach to implement Node-API for Hermes JS engine because I did not have the V8 facility to run secondary finalizer callbacks Node-API for Hermes. I can create the PR and we will see how far it goes.

calebmshafer added a commit to iTwin/itwinjs-core that referenced this issue Mar 11, 2022
* UI: Fix tree node icon alignment (#2853)

* Bug: MessageBoxIconType.NoSymbol shows Success icon instead of no symbol (#2998)

* Honor "None" and "No Symbol" for MessageBox
components

* Update testing

* extract-api

* Support view-independent decoration graphics (#3007)

* Default camera on for 3d View Creator (#3004)

Co-authored-by: Paul Connelly <[email protected]>

* 3.0.0-dev.182

* Remove @EarlinLutz from CODEOWNERS.md (#3013)

* Create integration tests (full stack tests) for RealityDataSource and RealityDataAccess client. (#2952)

* Create integration tests (full stack tests) for RealityDataSource and RealityDataAccess client.

* Put back package in alphabetical order

* Add changelog

* Revisited the way map layers authentication is handled in the UI. (#3009)

* Revisited the way map layers authentifcation is handled in the UI.

* Added changed log

* Added api files

* Fixed build errors following linting.  Updated changedlog message,

* Created new documentation group for map layers.

* Updated module directives to MapLayers

* Revert adjustZPlanes globe change (#3014)

* Sky cube primitive buffers must be bound when attempting to draw a sky cube.

* Revert adjustZPlanes globe change.

* rush extract-api

* rush change

* changelog unneeded for regression that was never released.

Co-authored-by: Paul Connelly <[email protected]>

* Updating map-layers code owner. (#3020)

* Optimize matrix calculation (#3022)

* optimize matrix calculation

* optimize matrix calculation

* remove vague changelog of no interest to package consumers

Co-authored-by: Paul Connelly <[email protected]>

* lock down itwinui-react version (#3023)

* 3.0.0-dev.183

* Unregister maplayers itemsProvider and widget control on terminate (#3003)

* Unregister maplayers itemsProvider and widget control on termine

* Added changelog.

* Dont register Widget control.

* Fix lint errors.

* Remove the itwin client package (#3021)

* Remove the `@bentley/itwin-client` package
* Roll the request wrappers into packages that need it, including imodelhub client, core-mobile and core-frontend

Co-authored-by: Paul Connelly <[email protected]>

* Fix schedule state synchronization (#3030)

* 2.19.14 - 2.19.28 changelogs (#3031)

* clean up old changelogs (#3029)

* Set correct dist-tag in publish pipeline (#2700)

* Fix bug where new releases of old versions would get 'latest' tag

* delete unused variables

* Update dist tag logic

* Improve logic for giving out 'previous' tag

* Fix bugs and add comments to dist tag script

* Handle empty versions

* Samw/element geometry builder params (#3017)

* option to specify geomstream as builder data on element/update

* wip

* more tests for elementGeometryBuilderParams when used by insert and update

* wip roughing in support for elementGeometryBuilderParams in geom parts

* mark new elementGeometryBuilderParams properties alpha

* wip elementGeometryBuilderParams for geometry parts

* extract-api

* rush change

* Distinguish element geometry builder params for parts from params for geometric elements

* rush extract-api

* Missing @alpha tag on new prop

* Wrong type for elementGeometryBuilderParams

* extract-api

* 3.0.0-dev.184

* Fix unhandled exception on iOS when exitPointerLock is called. (#3033)

* Presentation: Empty selection set after clear and replace (#3034)

* Add a test to reproduce selection set becoming empty due to unified selection after clearing and replacing selection set

* Fix unified selection tests to wait not only for `unified -> viewport` selection, but also for `viewport -> unified` selection to be synced

* Fix hilite set being cached with wrong guid

* rush change

* [build] Fix the use of the previousVer variable (#3037)

* Replace Viewport.readImage (#3035)

* readImageBuffer.

* Allow absolute viewport position so view rect can be precisely specified in pixels.

* testBlankViewport

* Test proving readImage reads upside-down.

* Test inverted y in view rect.

* Corresponding readImageBuffer tests.

* Implement readImageBuffer; tests pass.

* docs, rename.

* deprecate RenderTarget.readImage too.

* tests

* finish up tests.

* doc.

* NextVersion.md

* fix up callers of readImage.

* update test for correct behavior.

* update a couple more tests.

* extract-api

* doc is lie.

* completely unimportant typo.

* Provide default tool assistance for face/edge/vertex selection phase. (#3036)

* 3.0.0-dev.185

* 3.1.0-dev.0

* @bentley/imodeljs-native 3.1.1

* Update core-mobile API exports and release tags (#2836)

* Update core-mobile release tags

* Simplify RenderMaterial creation. (#3042)

* Simplify RenderMaterial creation.

* move webgl test to webgl dir.

* wip tests.

* wip test

* fix test.

* finish tests.

* docs.

* docs, deprecation

* Lint; NextVersion

* words.

* words words

* extract-api

* unused import.

* 3.1.0-dev.1

* fix presentation-full-stack-tests

* Remove element geometry update (#3045)

* Remove IModelDb.elementGeometryUpdate.

* Remove commented off code.

* 3.1.0-dev.2

* 3.1.0-dev.3

* 3.1.0-dev.4

* 3.1.0-dev.5

* Temporarily skip a new audit error (#3055)

* Bump patch version of Typedoc (#3056)

* Bump patch version of Typedoc

* Remove audit supression

* Entity is not an EntityProps. (#3052)

* Entity is not an EntityProps.

* Initial fixup.

* finish fixing up backend.

* docs, rename field

* fix compilation errors - mostly tests, mostly adding `toJSON` calls.

* extract-api

* lint

* Element.insert assigns to this.id.

* fix test.

* Properly handle floating widgets when no NineZoneState exists (#3046)

* Change initializeNineZoneState to properly handle floating widgets.

* rush change and extract-api

* rush update -- full

* 3.1.0-dev.6

* Presentation: Docs for contentinstancesofspecificclasses (#2979)

* added initial documentation

* added onlyIfNotHandled example

* Added missing tests for learning examples

* Updated documentation

* link fix

* improved docs according to grigas example

* reverted async on describe

* minor documentation fixes

* updated all example pngs, updated tests

* source files for example pictures

* Moved image sources to media, minor doc update

* updated test code to be more readable

* doc update for showImages attribute

* updated relatedproperties example, removed deprecated attribute from attribute table

* updated propertyCategories attribute examples and tests

* fix for Content tests

* doc fixes

* Update docs/presentation/Common-Rules/MultiSchemaClassesSpecification.md

According to roluk suggestion

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Common-Rules/MultiSchemaClassesSpecification.md

Doc wording improvement

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Content/ContentInstancesOfSpecificClasses.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Content/ContentInstancesOfSpecificClasses.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Content/ContentInstancesOfSpecificClasses.md

Co-authored-by: Robert Lukasonok <[email protected]>

* source and image files for excluded classes

* Update full-stack-tests/presentation/src/learning-snippets/Content.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Update full-stack-tests/presentation/src/learning-snippets/Content.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Update full-stack-tests/presentation/src/learning-snippets/Content.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Update full-stack-tests/presentation/src/learning-snippets/Content.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Update full-stack-tests/presentation/src/learning-snippets/Content.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Update full-stack-tests/presentation/src/learning-snippets/Content.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Update full-stack-tests/presentation/src/learning-snippets/Content.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* updated test description

* added excludedClasses property

* updated excludedClasses description

* updated excludedClasses test

* Update docs/presentation/Content/ContentInstancesOfSpecificClasses.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Content/ContentInstancesOfSpecificClasses.md

Co-authored-by: Robert Lukasonok <[email protected]>

Co-authored-by: Robert Lukasonok <[email protected]>

* update to the 1.0.0 version of the packages (#3054)

* initial changes (#3062)

* 3.1.0-dev.7

* Generalize the concept of a "tile user" (#3070)

* TileUser

* TileUser namespace.

* Viewport implements TileUser.

* LRUTileList

* TileAdmin, TileUsageMarker

* clean up usage of viewport where TileUser is indicated, and various non-uses.

* Reinstate+deprecate TileRequest.viewports; extract-api

* Reinstate

* extract-api

* remove TODO

* lint

* adjust for API changes.

* no deprecation.

* extract-api

* build code plz

* dpta

* fix doc link.

* Presentation docs contentrelatedinstances (#3016)

* added initial documentation

* added onlyIfNotHandled example

* Added missing tests for learning examples

* Updated documentation

* link fix

* improved docs according to grigas example

* reverted async on describe

* minor documentation fixes

* updated doc top header

* updated all example pngs, updated tests

* source files for example pictures

* Moved image sources to media, minor doc update

* updated test code to be more readable

* doc update for showImages attribute

* Updated md docs

* Added relationshipPaths test and snag file

* updated relatedproperties example, removed deprecated attribute from attribute table

* added doc image examples

* updated propertyCategories attribute examples and tests

* fix for Content tests

* refactured tests

* enabled check for ruleset printing

* updated doc accord to suggestions

* doc fixes

* fixed doc image anotations

* fixed related properties table

* Update docs/presentation/Common-Rules/MultiSchemaClassesSpecification.md

According to roluk suggestion

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Common-Rules/MultiSchemaClassesSpecification.md

Doc wording improvement

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Content/ContentInstancesOfSpecificClasses.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Content/ContentInstancesOfSpecificClasses.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Content/ContentInstancesOfSpecificClasses.md

Co-authored-by: Robert Lukasonok <[email protected]>

* source and image files for excluded classes

* Update full-stack-tests/presentation/src/learning-snippets/Content.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Update full-stack-tests/presentation/src/learning-snippets/Content.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Update full-stack-tests/presentation/src/learning-snippets/Content.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Update full-stack-tests/presentation/src/learning-snippets/Content.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Update full-stack-tests/presentation/src/learning-snippets/Content.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Update full-stack-tests/presentation/src/learning-snippets/Content.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Update full-stack-tests/presentation/src/learning-snippets/Content.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* updated test description

* added excludedClasses property

* updated relationshipPaths example

* updated shared property descriptions

* updated content.test descriptions

* updated instancefilter example

* updated media file namings for shared examples

* Update full-stack-tests/presentation/src/learning-snippets/Content.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Content/ContentRelatedInstances.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Content/ContentRelatedInstances.md

Co-authored-by: Robert Lukasonok <[email protected]>

Co-authored-by: Robert Lukasonok <[email protected]>

* Merge master into imodel02 (#3073)

Co-authored-by: Robert Lukasonok <[email protected]>
Co-authored-by: bbastings <[email protected]>
Co-authored-by: imodeljs-admin <[email protected]>
Co-authored-by: Caleb Shafer <[email protected]>
Co-authored-by: williamkbentley <[email protected]>
Co-authored-by: NancyMcCallB <[email protected]>
Co-authored-by: karolisab <[email protected]>
Co-authored-by: DStradley <[email protected]>

* Correct return status for processGeometryStream and createBRepGeometry. (#3074)

* Restore Integration test for RealityDataAccess  (#3019)

* Restore Integration test for RealityDataAccess "should get RealityDataSource for Open Street Map Building (OSM)"

* Add an assertion in the test to check that process.env.IMJS_CESIUM_ION_KEY is defined

* setup cesium ion key in integration test users pipeline

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Seamus Kirby <[email protected]>

* Move gather packages script to file (#3041)

* 3.1.0-dev.8

* Add silent sign in for electron (#2936)

Added silent signin for electron

* Restore missing images for ui learning docs (#3079)

* Draping support for reality meshes (#1487)

Co-authored-by: Ray.Bentley <[email protected]>
Co-authored-by: Paul Connelly <[email protected]>

* Add support for hosting an imodel view in a modeless dialog (#3068)

* Add code to test transparent content control.

* wip - save current progress

* Basic floating view functionality working

* Add a ContentDialogManager so z-index can be set for content dialogs.

* Set card popup z-index to appear above content view and content dialog.

* Fix location of popup context menu

* reset autohide timer when moving in dialog or popout content

* Force movable dialog's title bar to remain displayed.

* fix calling processViewSelectorChange too soon

* Require a ViewState to be specified to floating content.

* Close floating content when stage closes

* Update content tool to offset floating views.

* Add event that is triggered when floating content is added or removed.

* fix sizing of Select in maplayers widget

* update content example to show overlay opt-in

* Backstage should have not been deprecated - it is still used.

* fix showing active content

* Remove deprecated from Backstage and add hook export tag

* fix lint issue and test updates

* Add sample icon with transparency and fix hasMultipleContents logic

* rush change

* Move component location and add documentation.

* get coverage to pass

* fix typo in doc.

* add missing packageDocumentation

* Add info on floating view to NextVersion

* Fix path to floating view image and add image to NextVersion.

* 3.1.0-dev.9

* 3.1.0-dev.10

* 3.1.0-dev.11

* Temporarily add node-fetch audit to excluded advisories list (#3086) (#3087)

(cherry picked from commit 0d68e60c27b88433f3361a7ad8bed3d72a0aa47d)

Co-authored-by: Caleb Shafer <[email protected]>

* Non-pickable fixes for ambient occlusion (#3075)

* Sky cube primitive buffers must be bound when attempting to draw a sky cube.

* Revert adjustZPlanes globe change.

* Sort pickable and nonpickable draws when AO is drawn so nonpickable stuff does not try to draw without a pick buffer output bound. Change the AO shader so nonpickable stuff will work (wip, unsure).

* Shader change may have caused a large number of AO changes in Image Tests. Remove shader change to test. (AO will not apply to non-pickable decorations, but at least they will still render).

* Change the filtering of 'drawPrimitive' to key off of whether a shader outputs to pick rather than if a primitive "is pickable".  We were skipping rendering some geometry to the AO buffers.

* rush change

* trivial change

* Add two tests (clothoid, area boolean) (#3083)

* add clothoid projection & area boolean union tests

* lint

* 3.1.0-dev.12

* Presentation docs selectednodeinstances (#3028)

* added initial documentation

* added onlyIfNotHandled example

* Added missing tests for learning examples

* Updated documentation

* link fix

* improved docs according to grigas example

* reverted async on describe

* minor documentation fixes

* updated doc top header

* updated all example pngs, updated tests

* source files for example pictures

* Moved image sources to media, minor doc update

* updated test code to be more readable

* doc update for showImages attribute

* Updated md docs

* Added relationshipPaths test and snag file

* updated relatedproperties example, removed deprecated attribute from attribute table

* added doc image examples

* updated propertyCategories attribute examples and tests

* fix for Content tests

* refactured tests

* enabled check for ruleset printing

* updated table style, moved explanations to attributes

* finalized docs, added tests for unique attributes

* updated doc accord to suggestions

* doc fixes

* fixed doc image anotations

* fixed documentation annotations

* fixed related properties table

* updated unique property explanaitions

* fix for contentrelatedinstances relationship paths example

* updated documentation according to the PR review

* removed old snags, updated shared attribute descriptions

* removed outdated example files for calculated properties

* fixed test comments

* Update docs/presentation/Common-Rules/MultiSchemaClassesSpecification.md

Co-authored-by: Grigas <[email protected]>

* Update docs/presentation/Content/SelectedNodeInstances.md

Co-authored-by: Grigas <[email protected]>

Co-authored-by: Grigas <[email protected]>

* Reinstate implementations of LinearlyLocatedBase. (#3096)

* Update to latest itwin css version 0.44.0 (#3082)

* Update to itwinui-css": "0.44.0"

* remove target spec from map-layers tsconfig

* rush change

* Try explicitly setting maplayer compile options to see if it is related to doc build failure.

* Update to 0.44.1 release

* rush update

* Make it easier to sketch on faces of solids. (#3098)

* Dynamic import of ApproximateTerrainHeights data. (#3099)

* Steering.md (#3015)

* Create Steering.md
* charter document for iTwin.js steering committee.

Co-authored-by: Bill Goehrig <[email protected]>
Co-authored-by: Caleb Shafer <[email protected]>

* Fix rush change (#3107)

* move rush change to it's own script, pipe stderr to report errors properly
* remove fetchDepth arg

* 3.1.0-dev.13

* dta gltf keyin opens file picker if no URL supplied. (#3110)

* Workspace fonts (#3080)

* Work around compile error so ImageTests can build+run.

* use addNewFont rather than embedFont for tests

* fix imports

* clear fontmap when adding fonts via ImportContext

* documentation, extract-api

* documentation

* add documentation

Co-authored-by: Paul Connelly <[email protected]>

* Web IPC fix (support for reloading frontend). (#3100)

* Store IPC message sequence bookkeeping per connection...for example, a reloaded frontend.

* Stop publishing the imodelbank client (#3090) (#3112)

* Stop publishing the imodelbank client

(cherry picked from commit e48e062e01c5ca57f5cf5f616961d112f4ee41f6)

Co-authored-by: Caleb Shafer <[email protected]>

* 3.1.0-dev.14

* Add support to attach cesium ion asset from keyin (#3113)

* Add support to attach cesium ion asset from keyin like: "fdt attach cesium asset 75343"

* Extract API

* Rush change

* Add unit test

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* 3.1.0-dev.15

* Support draco-encoded point clouds and meshes (#3106)

* add draco dependencies.

* hook up draco point cloud.

* remove placeholder .d.ts

* Revert "hook up draco point cloud."

This reverts commit da6375d515cfd85407d8b1d7609251af9022dc48.

* Revert "remove placeholder .d.ts"
The @types/draco3d types look wrong and are missing all point cloud
APIs.

This reverts commit e4c56ae0ce0979eb3806be980bcfa63c744554c4.

* Remove @types/draco3d, it's incomplete.

* WIP fix up code for type checking.

* WIP replace DracoDecoder.

* Replace DracoDecoder.

* attribution

* Remove unused incorrectly-typed argument.

* Decode draco point cloud.

* Read draco mesh

* Create draco decoder ahead of time if needed.

* break out of loop on first draco mesh.

* Add @loaders.gl dependencies.

* Remove draco3d package and APIs.

* Populate map of decoded draco meshes.

* readDracoMeshPrimitive.

* It works.

* decode draco point clouds.

* extract-api

* lint

* NextVersion

* log

* Create predecessors even in generated js classes for the transformer, and handle deferred element relationships (#3115)

- consider navigation properties to be predecessors in non-core classes
  - add a skipped test for cyclical relationships which are valid but the transformer cannot handle currently. There is ongoing work to address this and that test can be unskipped then
- process relationships even if their elements were deferred
- added more exhaustive tests of data integrity when transforming iModels
  - these tests test a bug that was fixed in a native PR
- add a utility for checking if a class is a subclass of another. and if a JS Entity class is a subclass of another

Co-authored-by: Michael Belousov <[email protected]>

* Fix MapBox background map. (#3131)

Co-authored-by: Paul Connelly <[email protected]>

* 3.1.0-dev.16

* 3.1.0-dev.17

* 3.1.0-dev.18

* 3.1.0-dev.19

* Presentation: Fix failing full stack test (#3142)

Broken with https://bentleycs.visualstudio.com/iModelTechnologies/_git/imodel02/pullrequest/221223

* Fix aa planar edges (#3139)

* Fix aa for linear/planar interaction

* Add packageRoot directory to Typedoc output (#3116)

* update deps on external client pkgs (backport #3101) (#3143)

Co-authored-by: Caleb Shafer <[email protected]>
Co-authored-by: Arun George <[email protected]>
Co-authored-by: Paul Connelly <[email protected]>
Co-authored-by: Patrick Bell <[email protected]>
Co-authored-by: Arun George <[email protected]>

* Add ability to provide the date for Reporter entry (#3114)

* Add ability to provide the date for Reporter entry

* 3.1.0-dev.20

* Skip empty url segments (#3094)

* Skip empty path segments in web RPC URLs

* rush change

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Reinstate margin option for functions that fit a view to a volume (#3150)

* Functions that fit a view to a volume accept an optional MarginOptions specifying how tightly to fit.

* Roll dice on better mac/win agents

* Roll dice again

* Enhance SaveImageTool (#3151)

* SaveImageTool can copy to clipboard and accept image dimensions.

* README

* changelog

* Fix incorrect dist tag in publish script (#3092)

* Refactor and fix bug in gather packages script
* Better comment consistency in python script
* Add tests to gather_packages script
* Add missing branchName argument

* Update contributing guide to reference CLA in GitHub Gist (#3155)

* Deprecate IModelReadRpcInterface.getViewThumbnail (#3138)

* Deprecate IModelReadRpcInterface.getViewThumbnail
* Deprecate frontend function which calls this.
* Remove test/app usage of deprecated view thumbnail function.

* 3.1.0-dev.21

* InspectElementTool optionally also reports on part references' geometry. (#3158)

* Bump tile format version (#3157)

* WIP update to @bentley/imodeljs-native 3.1.3

* rush update.

* Merge cleanup

* extract-api

* lint

* Branching iModels with the transformation API doc article (#2963)

* Branching iModels with the transformation API doc article
* added a code conflict to existing branch iModel synchronization test to encode how it is handled
* minor fix an improperly cased bwc svg image reference which breaks doc generation on linux

Co-authored-by: Michael Belousov <[email protected]>

* update electron-authorization version; (#3164)

remove simple-get exception from rush audit

* 3.1.0-dev.22

* Presentation: Fix failing full stack test (#3142)

Broken with https://bentleycs.visualstudio.com/iModelTechnologies/_git/imodel02/pullrequest/221223

* Update to latest iTwinUi-React package (#3102)

* Update itwinui-react to 1.29.1

* update to 1.29.2

* order

* rush change

* Update to latest patch of itwinui-react

Co-authored-by: veekeys <[email protected]>

* Presentation: Doc enhancements for hierarchy specifications (#2977)

* Stop using `xmlhttprequest` to get localization working.

In most cases it's okay to just use EmptyLocalization. In cases when it's not, we can use jsdom.

* Doc enhancements for `InstanceNodesOfSpecificClassesSpecification`

* Doc enhancements for `RelatedInstanceNodesSpecification`

* Doc enhancements for CustomNodeSpecification

* Doc enhancements for CustomQueryInstanceNodesSpecification

* Doc enhancements for NodeArtifactsRule

* Misc. doc fixes

* Doc enhancements for GroupingRule

* Cleanup

* Add screenshots

* More doc enhancements

* extract-api

* Clean up extra whitespace

* Fix ruleset comments in learning snippet tests

* Update docs/presentation/Hierarchies/NodeArtifactsRule.md

Co-authored-by: Saulius Skliutas <[email protected]>

* `RelatedInstanceNodes` doesn't have a `classes` attribute

* Update callouts' style

* Update docs/presentation/Hierarchies/CustomNode.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Hierarchies/CustomNode.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Hierarchies/CustomNode.md

Co-authored-by: Robert Lukasonok <[email protected]>

* No need for a code snippet showing node's label - screenshot is enough

* Add example for when `hideNodesInHierarchy` is enabled and disabled

* Change `CustomNodeSpecification.type` snippet to show usage of parent node's type in child node condition

* Remove `.skip` from tests that now succeed after merge with master

* rush change

* lint

* restore pnpm lockfile

* Update docs/presentation/Hierarchies/CustomNode.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update full-stack-tests/presentation/src/learning-snippets/Hierarchies.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Hierarchies/CustomNode.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Remove code snippet showing CustomNodeSpecification.description usage result

* Add `true`/`false` examples for `hideIfNoChildren` spec

* Simplify `hideExpression` example

* Update example for `hasChildren` attribute

* Provide a better description for the custom query specifications' `class` attribute

* Make `CustomNodeSpecification.hideNodesInHierarchy` example specific to this specification

* Improve descriptions of `hideNodesInHierarchy` attribute

* Change the example for `hideIfNoChildren` attribute

* Simplify `hideExpression` attribute example

* restore pnpm-lock

Co-authored-by: Saulius Skliutas <[email protected]>
Co-authored-by: Robert Lukasonok <[email protected]>

* Avoid issue when stale viewstate is encountered (#3156)

* Aviod issue when stale viewstate is encountered

* rush change

* extract-api

* Add data attribute to buttons, widget, backstage items, and status fields (#3166)

* Initial change to ensure all DOM element genreated via itemProvides have data attributes that identify it and who provided it.

* Updates to only show new data attributes if value in defined.

* update to allow undefined props for data- items

* Add InspectUiItemTool in ui-test-app to show data attributes of UI items.

* rush change

* Fix lint issue

* UI: Document IModelViewport and DefaultViewOverlay components (#3137)

* IModelViewport

* Update index

* rush change

* Correct ReactNode spelling

* Update bgcolor info.

* 3.1.0-dev.23

* 3.1.0-dev.24

* 3.1.0-dev.25

* fix super call in automatic collectPredecessorIds impl and make stricter conditions for auto-implementing collectPredecessorIds (#3179)

- the previous method of getting the super class of `this` causes infinite recursion in deep class hierarchies. Instead, reference the super class's method directly so the call propagates up the prototype chain.
- because users may choose to not manually register a class in a hierarchy where they do manually register other classes, do not automatically implement `collectPredecessorIds` for generated classes that have a non-BisCore, manually-registered ancestor. This leaves the responsibility to the implementer to make sure they report all necessary predecessors. 
   
   When a user registers custom javascript classes for some schema, but "skips" implementing one class, (for example having A superclasses B superclasses C in the schema, and registering custom classes for A and C but leaving B generated), they will probably in javascript have their `class C extend A`, which means the super method would in fact be from `A`, not from the generated `B`.
   
   Since we cannot make `C` call `B`'s method for the supercall without requiring them to manually get the generated class from the registry, I have opted to disable generating the automatic method implementation for this case where they have a manually registered ancestor
- add tests of a deep hierarchy with mixed generated and registered classes

Co-authored-by: Michael Belousov <[email protected]>

* fix types/ws dev dep (#3163)

Co-authored-by: Arun George <[email protected]>

* Update devcontainer base to Debian 11 (#3178)

* Update devcontainer base to Debian 11

The version of Git packaged with Debian 10 (2.20.1) is too old for the
current version of Rush (which requires at least 2.30.0).

* Add libsecret to dev container

* fix the setup of the test-apps in a disconnected workflow (#3177)

* fix the setup of the test-apps in a disconnected workflow

* remove unneeded conditional

* @bentley/imodeljs-native 3.1.4

* @bentley/imodeljs-native 3.1.4

* Fixed typos in EdgeDisplay.md (backport #3181) (#3182)

Co-authored-by: RaphaelMelancon <[email protected]>

* remove reference to uncallable function.

* 3.1.0-dev.26

* Add new method to RealityDataSource (#3172)

* Add new methods to RealityDataSource:
-returns spatial location and extents.
-returns publisher product info for 3dTiles from scalable mesh.
Split RealityDataSource implementation by provider

* update documentation and extract api

* Rename getRealityDataPublisherInfo to etPublisherProductInfo

* Fix logic error

* Add integration test for two new RasterSource API:
getPublisherProductInfo
getSpatialLocationAndExtents

* Filter reality data list returned by Context Share and remove file types that cannot be display by display-test-app (e.g.: OMR files).

* Update documentation

* Update documentation

* Move rootChildren from PublisherProductInfo to internal ThreeDTileFileInfo.
Change rootChildren type to number.
Add a new internal method on ThreeDTileFormatInterpreter to getFileInfo.
Remove duplicate SpatialLocationAndExtents interface definition.
Update full-stack-test to test getFileInfo internal method.

* Extract-API

* SpatialLocationAndExtents is not a Props type. Change memeber to use class type instead of props.
Remove namespace RealityModelTileUtils and add method to ThreeDTileFormatInterpreter class instead.

* Extract-Api

* rootDocjson.root.children is an array, thus we can use rootDocjson.root.children.length without parsing to int.

* @bentley/imodeljs-native 3.1.5

* @bentley/imodeljs-native 3.1.5

* 3.1.0-dev.27

* Matrix4d inverse fix (#3184)

* stop-gap Matrix4d inversion fix

* refine scaling to fix Matrix4d inverse failure

* refine scaling to fix Matrix4d inverse failure

* Handle KrovakEN well-known text (fixes #3027) (#3168)

* Handle KrovakEN well-known text (fixes #3027)

Co-authored-by: Paul Connelly <[email protected]>

* Stop using process.exit() in certa.

Because several tests start http servers in their certa "backends", I also had to add the ability for a "backendInitModule" to supply a shutdown callback to close these servers.

* Fix lint.

* UI: Apply workaround to TreeNode for iTwinUI-react Checkbox bug (#3149)

* 3.0.0 changelogs (#3193)

* 3.0.0 changelogs

* 3.0.0 changelogs

Co-authored-by: imodeljs-admin <[email protected]>

* Implement pnts 3d tile spec (#3194)

* Support unquantized point clouds.

* Support all color formats.

* lint

* build code plz

* fix inconsequential typo in unused property name.

* Fix timer leak in PromiseMemoizer

* Can't support cleanup callbacks in certa electron tests yet.

Fortunately this is not yet needed, as electron is already properly calling onNodeExiting.

* Fix dpta signin when env vars undefined. (#3200)

* Autohide popups from the toolbar (#3201)

* Add context to allow popup toolbar items to autohide

* Add auto-hide login to the toolbar
overflow popup.

* Remove the left, rgith, and top borders from
dockt tool setttings (requested by
UX Standards).

* Add tests for setting hidden attribute
on overflow and tool popup.

* Rush change

* Lint errors

* Extract-api

* Remove unnecessary spaces from SCSS

* Removed unnecessary spaces.

Co-authored-by: bsteinbk <[email protected]>

* Presentation: Content customization doc enhancements (#3078)

* Content customization doc enhancements

* Update docs/presentation/Content/PropertyCategorySpecification.md

Co-authored-by: Saulius Skliutas <[email protected]>

* Update docs/presentation/Content/RendererSpecification.md

Co-authored-by: Saulius Skliutas <[email protected]>

* Clarify the `PropertyCategorySpecification.id` description

* Update docs/presentation/Content/DefaultPropertyCategoryOverride.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Content/DefaultPropertyCategoryOverride.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Content/PropertySpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Content/RelatedPropertiesSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Content/PropertyCategorySpecification.md

* Update docs/presentation/Content/PropertySpecification.md

* Update docs/presentation/Content/RelatedPropertiesSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/Content/RelatedPropertiesSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Improvements for `RelatedPropertiesSpecification.propertiesSource` docs

* Update docs/presentation/Content/PropertySpecification.md

Co-authored-by: karolisab <[email protected]>

Co-authored-by: Saulius Skliutas <[email protected]>
Co-authored-by: Robert Lukasonok <[email protected]>
Co-authored-by: karolisab <[email protected]>

* only expose IModelAppForDebugger in development (#3209)

Co-authored-by: Arun George <[email protected]>

* Query units schema (#3145)

* Check if base units matches for unit conversion and moved conversion tests to test folder

* Added checking base units matches for conversion tests

* Move expected parser data to json file for linting and use deserialize helper method

* Ran rush change and extract-api

* Initial querying units schema

* Changed querying phenomenon to check all schemas in context, added tests

* Changed from passing a filter function to Context to a forEach function for more generalize purposes

* Added initial finding units by display label and alternate display label

* Combined finding units by display label and alternate display label, changed to always return one unit instead of array

* Refactored findUnitByDisplayLabel to be more concise, added some comments, and removed other comments

* Created UnitsProvider using Unit Query and Converter classes, need to address comments

* Adding ecschema-metadata as peer dependency of frontend

* Renamed UnitQuery to UnitProvider, changed to use generator to iterate over schema items, use matchesFullName for full name comparison, added tests for getAlternateDisplayLabels, and added method to check if schemaItem is Unit

* add imodeljs-quantity as devDependency

* move formatEnums to quantity package

* remove duplicate utilities functions from Format

* update imports

* update dependencies versions

* Made common interface for UnitExtraData, added quantity as dependency to ecschema-metadata, and changed NewUnitsProvider to take in UnitExtraData

* remove some unnecessary checks for "undefined"

* add FormatBase class

* update tests errors messages

* Initial integrating new units provider to frontend

* Taking in SchemaContext in QuantityFormatter and IModelApp opts and added mock Units Schema in frontend tests

* Cleaned up linting errors

* Added comments and refactored NewUnitsProvider

* Replaced taking in SchemaContext with taking in UnitsProvider in QuantityFormatter and IModelApp

* Removed ecschema-metadata dependency from frontend and seperated alternate display labels from Unit Definition in BasicUnitsProvider

* Minor tweaks and refactorings

* fix build error

* Moved change made to file prior to relocation

* fixing issues after merge

* Reverting unwanted changes after merge

* reverting unwanted change after merge

* revert files

* Rename UnitProvider and implement interface

* wip

* wip

* wip

* merge with master

* lock file

* added fullstack test

* test failure fix

* test fix

* lint fixes

* api extraction

* lock file

* change logs

* fix dependency errors

* lock file

* docs fix

* use existing test bim for fullstack test

* lock file

* fix for intermittent test failure

* remove before/aftereach

* fixing case issue on linux build

* add way to reset to BasicUnitsProvider (#3167)

* run extract-api

* remove old comment

* remove unneeded imodeljsShardLibrary entry

* remove error prop from UnitConversionSpec

* make ecschema-metadata an optional dependency

* import schema and locater as types

* Eliminate need for caller to reinitialize when setting UnitsProvider

* extrackt-api

* update change log message

* alphabetize packages

* alphabetize more deps and other clean up

Co-authored-by: Ivan Kok <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Daumantas Jankauskas <[email protected]>
Co-authored-by: Bill Steinbock <[email protected]>
Co-authored-by: Caleb Shafer <[email protected]>

* Update Timeline to use dropdown menu from itwinui-react (#3213)

* Update Timeline to use DropDownMen from itwin-ui instead of ContextMenu.

* extract api

* Edl/tangent booleans (#3210)

* WIP first round curvature sort step.

* WIP tangent booleans work for test case, but still have problems if rotated.   Starting full circle issue

* Graph construction code after computing intersections did not account for curve portions before and after first and last intersection.

* api

* it.only

* console ok in test

* Enable code that was disabled for debugging

* Remove TODO

* eliminate fixed boolean

* Offset XY curve improvements (#3205)

* offset circles & ellipses

* B-spline curve xy-offset

* add offset distance spot-checks

* extract-api, it.only

* new CurvePrimitive.constructOffsetXY

* avoid circular ref when compiling tests

* it.only, skip test of clonePartialCurve on Bspline

* simplify changes

* Transform spatial view attachment's clip from drawing to sheet. (#3218)

* Do not produce illegal filenames on windows. (#3221)

* Do not produce illegal filenames on windows.

* lint

* 3.1.0-dev.28

* Promote quantity formatter to public (#3206)

* Promote QuantityFormatter to public

* update to mention caching of specs

* Update documentation

* More doc updates and promoting QuantityFormatter to public.

* Update Document

* Suggested edits toi quantity docs. (#3207)

* Add nextversion entry for SchemaUnitProvider

* Update NextVersion

* Add missing doc from public methods of quantityformatter.

* Add doc for all protected entries in QuantityFormatter

* rush change

* Add documentation for each QuantityType enum entry.

* Add documentation for a couple more interfaces used in quantity formatting.

Co-authored-by: NancyMcCallB <[email protected]>

* Define all ci and pr triggers in yaml pipelines (#3216)

* UI/check widget visibility (#3220)

* Add frontstageDef.isWidgetDisplayed() to allow
apps to query the visibility of widgets (for data loading)
Undeprecate wrongly-deprecated PanelStateChangedEventArgs
Return WidgetState.Floating from frontstageDef.getCurrentWidgetState()
if the widget is floating

* Rush change

* rush extract-api

* rerun extract-api on branch

* Test coverage

Co-authored-by: bsteinbk <[email protected]>

* Run integration tests on all platforms (#3208)

* Run integration tests on all platforms
* separate pr validation pipeline and add pipeline for full integration test validation
* add autocancel to core ci build

* Supply missing 'iModelJs' namespace in some calls to getLocalizedString (#3185)

* Fix missing 'iModelJs' namespaces in localization keys.
* Remove call to getLocalizeStringWithNamespace in favor of getLocalizedString.
* Remove second occurrence of getLocalizedStringWithNamespace.

* Suppress npm audit failure (#3230)

* 3.1.0-dev.29

* Model map layers (#2881)

* WIP - Initial settings

* Initial map tile tree changes for BIM layers

* Layer planar classifier creation

* Working version.

* Viewflags for map layers

* Map layer picking WI:

* WIP: Feature id support.

* Fix map layer classifier view falgs

* Set range corners on map tiles tp optimize culling

* Working version with features

* WIP - Working features

* Remove comment

* Fix clip mask

* Handle map layers above max with seperate meshes

* WIP - Layering with interleaved imagery and BIM

* Refine BIM layer tile clipping

* Transparency support for BIM map layers

* Force creation of map layer classifier texture

* Handle BIM layers when base is not imagery

* Remove debugging

* Model layer setting support

* model layer name cleanup

* Revert to single model for map layer

* Fix imports

* Documentation

* Model layer tests

* Fix test -- don't include subLayers if undefined.

* implement getMapLayerRange for model map layers

* Find map layers by source (which may be model id) rather than url

* extract-api

* extract-api

* NextVersion.md WIP -- fix findMapLayerByNameAndSource

* Added Model maplayers support to maplayers widget.

* Fix precision problem with matrix stored as Float32

* extract-api

* Reduce unnecessary allocations - tolerance model map layer overlap

* extract-api

* stop-gap Matrix4d inversion fix

* refine scaling to fix Matrix4d inverse failure

* refine scaling to fix Matrix4d inverse failure

* Fix test for model map layers

* Simplify MapLayerSettings - remove MapLayerSettingBase.  MapLayerProps still needs work

* Remove MapLayerPropsBase

* whitespace

* extract-api

* extract-api

* Remove isBase property.

* Use DialogButtonType from @itwin/appui-abstract instead of @itwin/core-react

* WIP - model map layers documentation

* Ensure v_eyeSpace is available.

* Only set credentials if available.  Always setting it to null will make deep object comparaison fails (i.e. typemoq)

* Handle preemultiplied texture RGB

* Set dimensions of classification texture to match viewport.

* No premultiplied alpha for imagery (non classified) tiles.

* Add map layer images

* Switch map layer images to JPEG

* Make sure the access keys are set to run PlanProjection tests.

* Revert "Make sure the access keys are set to run PlanProjection tests."

This reverts commit 6fc95a2516056fd6b6adaa2f1f43854862a2fa10.

* Tests that require bing access key must be integration tests.

* set map layer options; remove unused electronApp options.

* .only

* lint

* docs

Co-authored-by: Ray.Bentley <[email protected]>
Co-authored-by: Michel Dastous <[email protected]>
Co-authored-by: dassaf4 <[email protected]>
Co-authored-by: Paul Connelly <[email protected]>

* create extended spirals beyond [0,1] (#3134)

* create spirals beyond [0,1], move clothoid test

* create spirals beyond [0,1], move clothoid test

* PolyfaceBuilder.addMiteredPipes now handles elliptical cross sections (#3117)

* addMiteredPipes now handles elliptical sections

* extract-api

* extract-api

* Transparency+shadows workaround for Galaxy Note 8 (#3234)

* Marc.bedard8/reality data error (#3236)

* Return RealityDataError on invalid reality data source file

* extract-api

* fix node versions and conditions in integration tests (#3239)

* Fix effective fps to be in sync with effective total time (#3173)

* Fix namespace for geoNames extension (#3204)

* @bentley/imodeljs-native 3.1.6

* 3.1.0-dev.30

* 3.1.0-dev.31

* 3.1.0-dev.32

* support Azure Government tile cache (#3222)

* support Azure Government tile cache

* changelog

* add unit tests and fix bug

* oops

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* 3.1.0-dev.33

* Rush change.

* simplify SchemaUnitProvider implementation (#3242)

* simplify SchemaUnitProvider implementation

* change log and api extraction

* remove or since a context is a locater

* add log message

* update logger category

* another api extraction attempt

* lint fixes

* transformer workaround memory leak when processing large models (#3253)

- see this issue report of the leak https://github.com/nodejs/node-addon-api/issues/1140
- the leak appears to be a bug in node[-addon-api]. Tracing the gc shows JS heap size remains stable and old-generation garbage collection sweeps occur in parallel with the JS work, but objects that use `Napi::ObjectWrap` hold on to some memory until the thread yields. See the above issue for more details.
- the workaround is to force yield the javascript job in long loops
- the transformation service already employs this workaround to handle huge models

Co-authored-by: Michael Belousov <[email protected]>

* Map GetFeatureInfo (#2830)

Co-authored-by: MarcBedard8 <[email protected]>
Co-authored-by: Arun George <[email protected]>

* Bug fix: Right click on the 'New maplayer' dialog would close it (#3247)

* Bug fix: Right click on the new layer dialog would close it.

* changelog

* 3.1.0-dev.34

* react to breaking change in 3.0 wrt ecsql query row format (#3257)

Co-authored-by: Arun George <[email protected]>

* Fix panel size (#3260)

* Respect min/max size when initializing a panel.

* Rush change.

* Replace setImmediate usage with yield manager (#3261)

* add YieldManager

* replace setImmediate with yieldmanager

Co-authored-by: Michael Belousov <[email protected]>

* 3.1.0-dev.35

* Add new extension api (#2743)

* Added extensions project

* Added extension changes to core-frontend

* Added extension test placeholder

* Added extension ui-test-app

* Set new extension exports to alpha

* Change logs

* Added extension package documentation

* Updated code owners and removed unused test

* Extract-api

* Reverted changes to appui-react api

* Removed some common types from extension access

* Removed some frontend types from extensions

* Added real frontend functions

* Added more frontend exports

* Removed real ToolSettings

* Updated extensions to beta

* Removed broken link to extension docs

* Removed commented-out code

* Simplified extension test tool

* Merge fixes

* clean up API

* add kevin as codeowner for extensions

* cleanup core-extension

* core-frontend

* react to PR comments

* update lock file

* update lock

* update api docs

* pr comment + dont lint

* extract-api

* move enum to Extension.ts

* use proper types, cleanup tags

* fix gnarly comment

Co-authored-by: Caleb Shafer <[email protected]>
Co-authored-by: Arun George <[email protected]>
Co-authored-by: kckst8 <[email protected]>

* 3.1.0-dev.36

* Move Extensions to alpha (#3269)

* mark extension APIs as @alpha

* changes

* delete unnecessary change file

* re-add empty changes

* Mark core-geometry barrel as having sideEffects. (#3270)

* 3.1.0-dev.37

* 3.1.0-dev.38

* 3.1.0-dev.39

* Presentation: Fix presentation rpc requests caching (#3275)

* Fix requests memoization

* Fix a false log message

* Change the type of ToolAdmin.idleTool from IdleTool to InteractiveTool (#3277)

* Upgrade iTwinUI-react version 1.32.0 (#3271)

* update to latest itwinui package

* rush change

* Presentation: Optimize ModelsTree search ruleset (#3274)

* Optimize ModelsTree search ruleset

* rush change

* update the pnpmfile.cjs (#3281)

Co-authored-by: Arun George <[email protected]>

* 3.1.0-dev.40

* 3.0.1 changelogs (#3285)

Co-authored-by: imodeljs-admin <[email protected]>

* Refactor MapLayers UI (#3254)

Co-authored-by: Arun George <[email protected]>
Co-authored-by: Bill Steinbock <[email protected]>

* 3.1.0-dev.41

* Allow blank connections applications use map-layers widget 's  UserPreferences (#3256)

* Allow blank connections applications use map-layers widget 's  UserPreferences

* Make MapLayerManager fetch preferences even though thre is no iTwinId / iModelId

* Made iTwinid mandatory.  Also renamed any instance of projectId to iTwinid.

* Removed no longer needed blank connections Map to UserPreferencesMock

* Removed UserPreferencesMock leftover

* More renaming projectId-ITwinId

* iTwinId now mandatory for replaceSource

* changelog

* UI: Deprecate broken `IMutableGridCategoryItem` methods (#3286)

* UI: Remove Checkbox bug workaround (#3283)

* Update to open collapsed containing panel when open widget request is made (#3289)

* Ensure that widgetDef set/get widgetState accounts for collapsed panel.

* Update test coverage

* rush change

* extract-api and add change info to NextVersion.md

* 3.1.0-dev.42

* 3.2.0-dev.0

* 3.2.0-dev.1

* Presentation: Common rule docs (#3186)

* Add `chai-string` dependency to presentation-full-stack-tests

* Doc enhancements for `RelatedInstanceSpecification`

* Doc enhancements for `RelationshipPathSpecification`

* Add docs for `RepeatableRelationshipPathSpecification`

* Move `MultiSchemaClasses` learning snippet test into `CommonRules.test.ts`. Add a result image for it.

* Move common rule docs into presentation docs root to avoid having to provide an index for them

* Update docs/presentation/RelatedInstanceSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RelatedInstanceSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Remove unused `chai-string` dependency

* Update full-stack-tests/presentation/src/learning-snippets/CommonRules.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Extend the recursive relationship step step example

* Attempt to clarify `count: "*"`

* Restore unintentional changes

* Restore unintentional changes

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

Co-authored-by: Robert Lukasonok <[email protected]>

* implement clonePartialCurve for B-splines (#3294)

* addKnot, clone refactor

* impl Bezier/Bspline clonePartialCurve

* clone narrow, knot bracket/normalize, offset tests

* lint: CurvePrimitive.clone() narrowing

* missed a narrow

* missed another narrow

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Use relative links instead of $docs syntax (#3291)

* Use relative links instead of $docs syntax

* Fix bad merge

* Support unquantized vertex tables (#3288)

* Remove obsolete unused BingElevation-based terrain.

* MeshPointList

* Option to quantize positions.

* Simplify graphic args pt 1: delete MeshGraphicArgs.

* Get stuff (mostly tests) compiling.

* Clean up (to an extent) MeshArgs and PolylineArgs. Tests are annoying.

* remove obsolete TODO.

* Quantized vertex table builders.

* unquantized vertex table builders.

* Mesh/PolylineArgs.points doesn't need an add method.

* Vertex comparison tolerance based on quantization params or chord tolerance.

* fix dumb test.

* fix a couple tests.

* fix vertex comparison.

* Clarify feature index is 24 bits and material index is not produced by frontend code.

* indentation

* ShaderBuilderFlags is an object.

We will need max rgba per vertex shortly.

* Read vertex table data up front.

* Use pre-sampled data for position.

* Use pre-sampled data for normals and color index.

* Use pre-sampled vertex data everywhere.

* Support decoding unquantized vertex position.

* Point3dList.range; qparams can be used for deriving range even if positions are not quantized.

* Flag specifying whether positions are quantized.

* consolidate normal computation.

* When reading vertex data conditionalize based on whether positions are quantized.

* Decode unquantized polyline/edge endpoints.

* PolylineTesselator.

* Turn on unquantized positions for decorations.

Test failures ensue.

* fix 3 tests.

the rest of the failures are from rendering.

* Test for unquantized vertex table (failing).

* Get test passing.

* unquantized geometry now renders correctly.

* update TODO. Probably won't address.

* Define unquantized positions relative to center of range.

* Update test.

* extract-api

* lint....

* please build my code.

* 3.2.0-dev.2

* 3.2.0-dev.3

* 3.2.0-dev.4

* 3.2.0-dev.5

* Reimplement deprecated getViewThumbnail function to resolve regression (#3306)

* Reimplement deprecated getViewThumbnail function to resolve regression

* allow LineString3d.clonePartialCurve() to extend the instance (#3315)

* allow extending LineString3d in clonePartialCurve

* testing, narrowing

* 3.2.0-dev.6

* Fixed issue that would close the new maplayer dialog when a new layer type was picked. (#3313)

* Fixed issue that would close the new maplayer dialog when a new layer type was picked.

* No need to resume outside click handling  when the whole panel is unloaded.

* changelog

* Fix background base color (#3318)

* 3.2.0-dev.7

* Improved validation of ESRI services before adding map layer (#3321)

* Validate  ESRI service supports 'Map' requests before making further tile requests.

* changelog

* Allow UI to initialize to old interface (#3322)

* Allow initial UI version to be set when UIFramework is initialized

* Rush change and add note about testing 1.0 mode.

* fix typo in ui-test-app

* Control active model/category in display-test-app (#3323)

* Fix 'ResizeObserver loop limit exceeded' error in MapLayers widget (#3305)

* Replaced useResizeDerector by UseLayoutResizeObserver

* changelog

* fixed CSS typo

* 3.2.0-dev.8

* Presentation: Customization rules documentation improvement (#3267)

* Update StyleOverride rule docs

* Update LabelOverride rule docs

* Update ImageIdOverride rule docs

* Update CheckBoxRule docs

* Add way to customize tree node items in data provider

* Deprecated some customization rules and corresponding node properties

* Add learning snippets for customization rules

* Add example snippets for SortingRule attributes

* Add example snippets for InstanceLabelOverride rule attributes

* Add example snippets for ExtendedDataRule attributes

* Restructure customization rules docs index

* Deprecated Item.imageId property

* Add docs for ExtendedDataRule usage

* Cleanup ExtendedDataUsage docs

* Add example images

* Fix node order check in hierarchies test

* Add links to attributes table

* Deprecate showImages attribute

* Make types referenced comment into links

* Sort imports

* Commit missing snapshot

* Fix typo in ExtendedDataRule ruleset snippet

* Fix typo

* Update instance label override class attribute snippet

* Fix identation

* Remove unnecessary suggestion to use InstanceLabelOverride

* Add more links to extended data usage page

* Update callouts in example images

* Improve sorting rule required schemas example

* extract-api

* Fix typos

* Fix typo

* Fix ruleset description

* Add better examples for disabled sorting rule

* Remove remark

* Rush change

* Add illustrations for requiredSchemas attribute

* Improve condition result value column naming

* Add missing comma

* Fix test

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Remove limit for categories query in display-test-app (#3310)

* up  limit for categories

* removed limit altogether

* Presentation: Fix paged request result accumulation (#3329)

* Avoid infinite loop when building paged requests response

* Rush change

* Update presentation/frontend/src/test/PresentationManager.test.ts

Co-authored-by: Grigas <[email protected]>

Co-authored-by: Grigas <[email protected]>

* return 404 status in RPC when iModel is not open (#3330)

* return 404 status in RPC when iModel is not open

* change

* remove redundant throw

* remove unused import

* Tools for modifying path/region geometry. (#3335)

* Tools for modifying path/region geometry.

* extract-api

* 3.0.2 changelogs (#3336)

Co-authored-by: imodeljs-admin <[email protected]>

* 3.2.0-dev.9

* Expose iTwin.js Core Version for extensions/embed-api (#3287)

Co-authored-by: Arun George <[email protected]>

Co-authored-by: imodeljs-admin <[email protected]>
Co-authored-by: Robert Lukasonok <[email protected]>
Co-authored-by: NancyMcCallB <[email protected]>
Co-authored-by: Paul Connelly <[email protected]>
Co-authored-by: kckst8 <[email protected]>
Co-authored-by: MarcBedard8 <[email protected]>
Co-authored-by: Michel D'Astous <[email protected]>
Co-authored-by: markschlosseratbentley <[email protected]>
Co-authored-by: MarcNeely <[email protected]>
Co-authored-by: Caleb Shafer <[email protected]>
Co-authored-by: Seamus Kirby <[email protected]>
Co-authored-by: Sam Wilson <[email protected]>
Co-authored-by: Travis Cobbs <[email protected]>
Co-authored-by: Grigas <[email protected]>
Co-authored-by: bbastings <[email protected]>
Co-authored-by: kabentley <[email protected]>
Co-authored-by: GerardasB <[email protected]>
Co-authored-by: Bill Steinbock <[email protected]>
Co-authored-by: Robert Schili <[email protected]>
Co-authored-by: hnn0003 <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Michael Belousov <[email protected]>
Co-authored-by: Michael Belousov <[email protected]>
Co-authored-by: Colin Kerr <[email protected]>
Co-authored-by: williamkbentley <[email protected]>
Co-authored-by: affank <[email protected]>
Co-authored-by: Affan Khan <[email protected]>
Co-authored-by: swbsi <[email protected]>
Co-authored-by: Matt.Gooding <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: karolisab <[email protected]>
Co-authored-by: DStradley <48810710+DS…
calebmshafer added a commit to iTwin/itwinjs-core that referenced this issue Mar 23, 2022
* transformer workaround memory leak when processing large models (#3253)

- see this issue report of the leak nodejs/node-addon-api#1140
- the leak appears to be a bug in node[-addon-api]. Tracing the gc shows JS heap size remains stable and old-generation garbage collection sweeps occur in parallel with the JS work, but objects that use `Napi::ObjectWrap` hold on to some memory until the thread yields. See the above issue for more details.
- the workaround is to force yield the javascript job in long loops
- the transformation service already employs this workaround to handle huge models

Co-authored-by: Michael Belousov <[email protected]>

* Map GetFeatureInfo (#2830)

Co-authored-by: MarcBedard8 <[email protected]>
Co-authored-by: Arun George <[email protected]>

* Bug fix: Right click on the 'New maplayer' dialog would close it (#3247)

* Bug fix: Right click on the new layer dialog would close it.

* changelog

* 3.1.0-dev.34

* react to breaking change in 3.0 wrt ecsql query row format (#3257)

Co-authored-by: Arun George <[email protected]>

* Fix panel size (#3260)

* Respect min/max size when initializing a panel.

* Rush change.

* Replace setImmediate usage with yield manager (#3261)

* add YieldManager

* replace setImmediate with yieldmanager

Co-authored-by: Michael Belousov <[email protected]>

* 3.1.0-dev.35

* Add new extension api (#2743)

* Added extensions project

* Added extension changes to core-frontend

* Added extension test placeholder

* Added extension ui-test-app

* Set new extension exports to alpha

* Change logs

* Added extension package documentation

* Updated code owners and removed unused test

* Extract-api

* Reverted changes to appui-react api

* Removed some common types from extension access

* Removed some frontend types from extensions

* Added real frontend functions

* Added more frontend exports

* Removed real ToolSettings

* Updated extensions to beta

* Removed broken link to extension docs

* Removed commented-out code

* Simplified extension test tool

* Merge fixes

* clean up API

* add kevin as codeowner for extensions

* cleanup core-extension

* core-frontend

* react to PR comments

* update lock file

* update lock

* update api docs

* pr comment + dont lint

* extract-api

* move enum to Extension.ts

* use proper types, cleanup tags

* fix gnarly comment

Co-authored-by: Caleb Shafer <[email protected]>
Co-authored-by: Arun George <[email protected]>
Co-authored-by: kckst8 <[email protected]>

* 3.1.0-dev.36

* Move Extensions to alpha (#3269)

* mark extension APIs as @Alpha

* changes

* delete unnecessary change file

* re-add empty changes

* Mark core-geometry barrel as having sideEffects. (#3270)

* 3.1.0-dev.37

* 3.1.0-dev.38

* 3.1.0-dev.39

* Presentation: Fix presentation rpc requests caching (#3275)

* Fix requests memoization

* Fix a false log message

* Change the type of ToolAdmin.idleTool from IdleTool to InteractiveTool (#3277)

* Upgrade iTwinUI-react version 1.32.0 (#3271)

* update to latest itwinui package

* rush change

* Presentation: Optimize ModelsTree search ruleset (#3274)

* Optimize ModelsTree search ruleset

* rush change

* update the pnpmfile.cjs (#3281)

Co-authored-by: Arun George <[email protected]>

* 3.1.0-dev.40

* 3.0.1 changelogs (#3285)

Co-authored-by: imodeljs-admin <[email protected]>

* Refactor MapLayers UI (#3254)

Co-authored-by: Arun George <[email protected]>
Co-authored-by: Bill Steinbock <[email protected]>

* 3.1.0-dev.41

* Allow blank connections applications use map-layers widget 's  UserPreferences (#3256)

* Allow blank connections applications use map-layers widget 's  UserPreferences

* Make MapLayerManager fetch preferences even though thre is no iTwinId / iModelId

* Made iTwinid mandatory.  Also renamed any instance of projectId to iTwinid.

* Removed no longer needed blank connections Map to UserPreferencesMock

* Removed UserPreferencesMock leftover

* More renaming projectId-ITwinId

* iTwinId now mandatory for replaceSource

* changelog

* UI: Deprecate broken `IMutableGridCategoryItem` methods (#3286)

* UI: Remove Checkbox bug workaround (#3283)

* Update to open collapsed containing panel when open widget request is made (#3289)

* Ensure that widgetDef set/get widgetState accounts for collapsed panel.

* Update test coverage

* rush change

* extract-api and add change info to NextVersion.md

* 3.1.0-dev.42

* 3.2.0-dev.0

* 3.2.0-dev.1

* Presentation: Common rule docs (#3186)

* Add `chai-string` dependency to presentation-full-stack-tests

* Doc enhancements for `RelatedInstanceSpecification`

* Doc enhancements for `RelationshipPathSpecification`

* Add docs for `RepeatableRelationshipPathSpecification`

* Move `MultiSchemaClasses` learning snippet test into `CommonRules.test.ts`. Add a result image for it.

* Move common rule docs into presentation docs root to avoid having to provide an index for them

* Update docs/presentation/RelatedInstanceSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RelatedInstanceSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Remove unused `chai-string` dependency

* Update full-stack-tests/presentation/src/learning-snippets/CommonRules.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Extend the recursive relationship step step example

* Attempt to clarify `count: "*"`

* Restore unintentional changes

* Restore unintentional changes

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

Co-authored-by: Robert Lukasonok <[email protected]>

* implement clonePartialCurve for B-splines (#3294)

* addKnot, clone refactor

* impl Bezier/Bspline clonePartialCurve

* clone narrow, knot bracket/normalize, offset tests

* lint: CurvePrimitive.clone() narrowing

* missed a narrow

* missed another narrow

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Use relative links instead of $docs syntax (#3291)

* Use relative links instead of $docs syntax

* Fix bad merge

* Support unquantized vertex tables (#3288)

* Remove obsolete unused BingElevation-based terrain.

* MeshPointList

* Option to quantize positions.

* Simplify graphic args pt 1: delete MeshGraphicArgs.

* Get stuff (mostly tests) compiling.

* Clean up (to an extent) MeshArgs and PolylineArgs. Tests are annoying.

* remove obsolete TODO.

* Quantized vertex table builders.

* unquantized vertex table builders.

* Mesh/PolylineArgs.points doesn't need an add method.

* Vertex comparison tolerance based on quantization params or chord tolerance.

* fix dumb test.

* fix a couple tests.

* fix vertex comparison.

* Clarify feature index is 24 bits and material index is not produced by frontend code.

* indentation

* ShaderBuilderFlags is an object.

We will need max rgba per vertex shortly.

* Read vertex table data up front.

* Use pre-sampled data for position.

* Use pre-sampled data for normals and color index.

* Use pre-sampled vertex data everywhere.

* Support decoding unquantized vertex position.

* Point3dList.range; qparams can be used for deriving range even if positions are not quantized.

* Flag specifying whether positions are quantized.

* consolidate normal computation.

* When reading vertex data conditionalize based on whether positions are quantized.

* Decode unquantized polyline/edge endpoints.

* PolylineTesselator.

* Turn on unquantized positions for decorations.

Test failures ensue.

* fix 3 tests.

the rest of the failures are from rendering.

* Test for unquantized vertex table (failing).

* Get test passing.

* unquantized geometry now renders correctly.

* update TODO. Probably won't address.

* Define unquantized positions relative to center of range.

* Update test.

* extract-api

* lint....

* please build my code.

* 3.2.0-dev.2

* 3.2.0-dev.3

* 3.2.0-dev.4

* 3.2.0-dev.5

* Reimplement deprecated getViewThumbnail function to resolve regression (#3306)

* Reimplement deprecated getViewThumbnail function to resolve regression

* allow LineString3d.clonePartialCurve() to extend the instance (#3315)

* allow extending LineString3d in clonePartialCurve

* testing, narrowing

* 3.2.0-dev.6

* Fixed issue that would close the new maplayer dialog when a new layer type was picked. (#3313)

* Fixed issue that would close the new maplayer dialog when a new layer type was picked.

* No need to resume outside click handling  when the whole panel is unloaded.

* changelog

* Fix background base color (#3318)

* 3.2.0-dev.7

* Improved validation of ESRI services before adding map layer (#3321)

* Validate  ESRI service supports 'Map' requests before making further tile requests.

* changelog

* Allow UI to initialize to old interface (#3322)

* Allow initial UI version to be set when UIFramework is initialized

* Rush change and add note about testing 1.0 mode.

* fix typo in ui-test-app

* Control active model/category in display-test-app (#3323)

* Fix 'ResizeObserver loop limit exceeded' error in MapLayers widget (#3305)

* Replaced useResizeDerector by UseLayoutResizeObserver

* changelog

* fixed CSS typo

* 3.2.0-dev.8

* Presentation: Customization rules documentation improvement (#3267)

* Update StyleOverride rule docs

* Update LabelOverride rule docs

* Update ImageIdOverride rule docs

* Update CheckBoxRule docs

* Add way to customize tree node items in data provider

* Deprecated some customization rules and corresponding node properties

* Add learning snippets for customization rules

* Add example snippets for SortingRule attributes

* Add example snippets for InstanceLabelOverride rule attributes

* Add example snippets for ExtendedDataRule attributes

* Restructure customization rules docs index

* Deprecated Item.imageId property

* Add docs for ExtendedDataRule usage

* Cleanup ExtendedDataUsage docs

* Add example images

* Fix node order check in hierarchies test

* Add links to attributes table

* Deprecate showImages attribute

* Make types referenced comment into links

* Sort imports

* Commit missing snapshot

* Fix typo in ExtendedDataRule ruleset snippet

* Fix typo

* Update instance label override class attribute snippet

* Fix identation

* Remove unnecessary suggestion to use InstanceLabelOverride

* Add more links to extended data usage page

* Update callouts in example images

* Improve sorting rule required schemas example

* extract-api

* Fix typos

* Fix typo

* Fix ruleset description

* Add better examples for disabled sorting rule

* Remove remark

* Rush change

* Add illustrations for requiredSchemas attribute

* Improve condition result value column naming

* Add missing comma

* Fix test

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Remove limit for categories query in display-test-app (#3310)

* up  limit for categories

* removed limit altogether

* Presentation: Fix paged request result accumulation (#3329)

* Avoid infinite loop when building paged requests response

* Rush change

* Update presentation/frontend/src/test/PresentationManager.test.ts

Co-authored-by: Grigas <[email protected]>

Co-authored-by: Grigas <[email protected]>

* return 404 status in RPC when iModel is not open (#3330)

* return 404 status in RPC when iModel is not open

* change

* remove redundant throw

* remove unused import

* Tools for modifying path/region geometry. (#3335)

* Tools for modifying path/region geometry.

* extract-api

* 3.0.2 changelogs (#3336)

Co-authored-by: imodeljs-admin <[email protected]>

* 3.2.0-dev.9

* Expose iTwin.js Core Version for extensions/embed-api (#3287)

Co-authored-by: Arun George <[email protected]>

* @bentley/imodeljs-native 3.2.0

* Pin reality-data-client to 0.7.0 due to bug in 0.7.1

* use relative links for md-> md linking

* Fix DisplayStyleState.changeBackgroundMapProvider (#3346)

* 3.2.0-dev.10

* 3.2.0-dev.11

* 3.2.0-dev.12

* BriefcaseConnection.activeSettings (#3341)

* Clean up nextversion.md

* Provide API to detect integrated graphics (#3324)

* first cut

* comment.

* NextVersion

* comment

* rush change

* rush extract-api

* Clean up changelog; add sample code.

* beta -> public

* fix doc link

* Add testing. Also tweak integrated detection logic - unmasked vendor is unreliable.  Detect Iris differently to work for cases in the wild.

* simplify conditional to test integrated.

Co-authored-by: Paul Connelly <[email protected]>

* disable lint warning for deprecation

* Merge with master

* rush change

* 3.2.0-dev.13

* initial Webpack 5 support (#3320)

Co-authored-by: Arun George <[email protected]>

* ColorDef validation and ColorByName fix (#3360)

* ColorByName is an object not an enum

Add ColorDef validation.

* Test ColorDef.getName

* docs, types.

* lint, extract-api

* NextVersion.md

* why aren't integration tests running?

* so much casting.

* 3.2.0-dev.14

* @bentley/imodeljs-native 3.2.1

* 3.2.0-dev.15

* @bentley/imodeljs-native 3.2.1

* Remove dependency on sprite loader (#3369)

* WIP

* WIP

* Remove all sprite references from ui-items-providers-test

* Testing for IconComponent web component icons
Change IconComponent tests to react-teating-library
Remove unused code from IconComponent

* use import statement to load local svgs

* Remove sprite usage from teh core packages
Deprecate sprite functionality

* rush change

* Remove  most sprite reference from ui-test-app,
leaving some in for test coverage.

* Extract-api

* correct doc typo

* Edit docs for clarity.

* Fix lint errors
Update NextVersion with deprecations

* Doc correction

* Fix length in getWebComponentSource

* Fix bad docs links

* Fix UI provider bug and add new provider param to isSupportedStage callback (#3377)

* fix bug where the wrong number of parameters were being passed

* fix missing parameter in provide widgets

* rush change

* 3.2.0-dev.16

* Presentation: Fix tile links in the documentation index page (#3372)

* @bentley/imodeljs-native 3.2.1

* small comment change

* Improve custom property value renderers' docs (#3370)

* Add the ability to skip the cross origin check (#3385)

* Add the ability to skip the cross origin check

Update imageElementFromUrl and tryImageElementFromUrl to have a new optional parameter (default false) that when set to true will skip the cross origin check when loading the image.

* Document API changes.

* extract-api

* 3.2.0-dev.17

* 3.2.0-dev.18

* 3.2.0-dev.19

* Provide an error message when IModelHost.hubAccess is undefined (#3391)

* bump to [email protected] (#3376)

* bump to [email protected]
* move form `onKeyPress` to `onKeyDown`

Co-authored-by: Arun George <[email protected]>

* 3.2.0-dev.20

* Remove 2.x extension api (#3353)

* kill off old extension api

Co-authored-by: Arun George <[email protected]>

* Fix for 3 new vulnerabilities. React to new @types/react version (#3399)

Update to fix a few build issues in the ui packages with new @types/react version.

Fix for 3 new vulnerabilities:

- minimist has a new vulnerability for the older versions of the package. Update display perf test app to the latest version of chrome-launcher to fix.
- node-forge has two new CVEs (here and here) and is a transitive dependency of webpack-dev-server and react-scripts. Unfortunately webpack-dev-server is locked down to a specific version of the selfsigned package, the package with a dependency on node-forge, which is on an old major version of the node-forge. The only way to fix this would be to either fork webpack-dev-server (which we don't want to do) or update to react-scripts@5 that is on the latest version.
- faker.js, a dev dependency used for testing, that is consumed by the presentation tests. There is no current fix so it has been added to the excluded list.

Co-authored-by: bsteinbk <[email protected]>

* Show usage of itwin UI Menu and Dropdown menu in place of core-react ContextMenu (#3293)

* Allow default tool to be started on frontstage activation even if a defaultTool is not specified in stage

* working on using itwinui's menus to replace core-react components.

* Reinstate a couple boxshadow variables use in DatePicker.

* Deprecate ShowHideMenu used in deprcated table

* Add appendTo="parent" to DropdownMenu specification

* Add NextVersion entry about deprecations.

* 3.2.0-dev.21

* Make it easier to override display-test-app configuration. (#3400)

* Make it easier to override display-test-app configuration.

* clarify.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Presentation: Learning snippets cleanup (#3386)

* Move `printRuleset` function into a shared utils file

* Split learning snippets into separate files

* Prefix all learning snippets with `Presentation.` to avoid collisions with non-presentation snippets

* Fix mixed up content specification learning snippets

Co-authored-by: Michael Belousov <[email protected]>
Co-authored-by: Michael Belousov <[email protected]>
Co-authored-by: Michel D'Astous <[email protected]>
Co-authored-by: MarcBedard8 <[email protected]>
Co-authored-by: Arun George <[email protected]>
Co-authored-by: imodeljs-admin <[email protected]>
Co-authored-by: Arun George <[email protected]>
Co-authored-by: GerardasB <[email protected]>
Co-authored-by: Spencer Barnes <[email protected]>
Co-authored-by: Caleb Shafer <[email protected]>
Co-authored-by: kckst8 <[email protected]>
Co-authored-by: Bill Goehrig <[email protected]>
Co-authored-by: Grigas <[email protected]>
Co-authored-by: Paul Connelly <[email protected]>
Co-authored-by: Bill Steinbock <[email protected]>
Co-authored-by: Seamus Kirby <[email protected]>
Co-authored-by: Robert Lukasonok <[email protected]>
Co-authored-by: dassaf4 <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: williamkbentley <[email protected]>
Co-authored-by: Saulius Skliutas <[email protected]>
Co-authored-by: MarcNeely <[email protected]>
Co-authored-by: Paulius Valiūnas <[email protected]>
Co-authored-by: bbastings <[email protected]>
Co-authored-by: markschlosseratbentley <[email protected]>
Co-authored-by: AJMigliore <[email protected]>
Co-authored-by: NancyMcCallB <[email protected]>
Co-authored-by: Travis Cobbs <[email protected]>
Co-authored-by: mgooding <[email protected]>
@MichaelBelousov MichaelBelousov changed the title potential memory leak in unyielding JS jobs creating ObjectWrap-ed native objects unbounded memory usage in unyielding JS jobs creating ObjectWrap-ed native objects Apr 16, 2022
@github-actions
Copy link
Contributor

This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.

@mhdawson
Copy link
Member

We discussed today in the team meeting, the work on feature bits will help, so waiting on that to move this forward.

MichaelBelousov added a commit to iTwin/imodel-transformer that referenced this issue Mar 1, 2023
- see this issue report of the leak nodejs/node-addon-api#1140
- the leak appears to be a bug in node[-addon-api]. Tracing the gc shows JS heap size remains stable and old-generation garbage collection sweeps occur in parallel with the JS work, but objects that use `Napi::ObjectWrap` hold on to some memory until the thread yields. See the above issue for more details.
- the workaround is to force yield the javascript job in long loops
- the transformation service already employs this workaround to handle huge models

Co-authored-by: Michael Belousov <[email protected]>
MichaelBelousov added a commit to iTwin/imodel-transformer that referenced this issue Mar 1, 2023
* transformer workaround memory leak when processing large models (#3253)

- see this issue report of the leak nodejs/node-addon-api#1140
- the leak appears to be a bug in node[-addon-api]. Tracing the gc shows JS heap size remains stable and old-generation garbage collection sweeps occur in parallel with the JS work, but objects that use `Napi::ObjectWrap` hold on to some memory until the thread yields. See the above issue for more details.
- the workaround is to force yield the javascript job in long loops
- the transformation service already employs this workaround to handle huge models

Co-authored-by: Michael Belousov <[email protected]>

* Map GetFeatureInfo (#2830)

Co-authored-by: MarcBedard8 <[email protected]>
Co-authored-by: Arun George <[email protected]>

* Bug fix: Right click on the 'New maplayer' dialog would close it (#3247)

* Bug fix: Right click on the new layer dialog would close it.

* changelog

* 3.1.0-dev.34

* react to breaking change in 3.0 wrt ecsql query row format (#3257)

Co-authored-by: Arun George <[email protected]>

* Fix panel size (#3260)

* Respect min/max size when initializing a panel.

* Rush change.

* Replace setImmediate usage with yield manager (#3261)

* add YieldManager

* replace setImmediate with yieldmanager

Co-authored-by: Michael Belousov <[email protected]>

* 3.1.0-dev.35

* Add new extension api (#2743)

* Added extensions project

* Added extension changes to core-frontend

* Added extension test placeholder

* Added extension ui-test-app

* Set new extension exports to alpha

* Change logs

* Added extension package documentation

* Updated code owners and removed unused test

* Extract-api

* Reverted changes to appui-react api

* Removed some common types from extension access

* Removed some frontend types from extensions

* Added real frontend functions

* Added more frontend exports

* Removed real ToolSettings

* Updated extensions to beta

* Removed broken link to extension docs

* Removed commented-out code

* Simplified extension test tool

* Merge fixes

* clean up API

* add kevin as codeowner for extensions

* cleanup core-extension

* core-frontend

* react to PR comments

* update lock file

* update lock

* update api docs

* pr comment + dont lint

* extract-api

* move enum to Extension.ts

* use proper types, cleanup tags

* fix gnarly comment

Co-authored-by: Caleb Shafer <[email protected]>
Co-authored-by: Arun George <[email protected]>
Co-authored-by: kckst8 <[email protected]>

* 3.1.0-dev.36

* Move Extensions to alpha (#3269)

* mark extension APIs as @Alpha

* changes

* delete unnecessary change file

* re-add empty changes

* Mark core-geometry barrel as having sideEffects. (#3270)

* 3.1.0-dev.37

* 3.1.0-dev.38

* 3.1.0-dev.39

* Presentation: Fix presentation rpc requests caching (#3275)

* Fix requests memoization

* Fix a false log message

* Change the type of ToolAdmin.idleTool from IdleTool to InteractiveTool (#3277)

* Upgrade iTwinUI-react version 1.32.0 (#3271)

* update to latest itwinui package

* rush change

* Presentation: Optimize ModelsTree search ruleset (#3274)

* Optimize ModelsTree search ruleset

* rush change

* update the pnpmfile.cjs (#3281)

Co-authored-by: Arun George <[email protected]>

* 3.1.0-dev.40

* 3.0.1 changelogs (#3285)

Co-authored-by: imodeljs-admin <[email protected]>

* Refactor MapLayers UI (#3254)

Co-authored-by: Arun George <[email protected]>
Co-authored-by: Bill Steinbock <[email protected]>

* 3.1.0-dev.41

* Allow blank connections applications use map-layers widget 's  UserPreferences (#3256)

* Allow blank connections applications use map-layers widget 's  UserPreferences

* Make MapLayerManager fetch preferences even though thre is no iTwinId / iModelId

* Made iTwinid mandatory.  Also renamed any instance of projectId to iTwinid.

* Removed no longer needed blank connections Map to UserPreferencesMock

* Removed UserPreferencesMock leftover

* More renaming projectId-ITwinId

* iTwinId now mandatory for replaceSource

* changelog

* UI: Deprecate broken `IMutableGridCategoryItem` methods (#3286)

* UI: Remove Checkbox bug workaround (#3283)

* Update to open collapsed containing panel when open widget request is made (#3289)

* Ensure that widgetDef set/get widgetState accounts for collapsed panel.

* Update test coverage

* rush change

* extract-api and add change info to NextVersion.md

* 3.1.0-dev.42

* 3.2.0-dev.0

* 3.2.0-dev.1

* Presentation: Common rule docs (#3186)

* Add `chai-string` dependency to presentation-full-stack-tests

* Doc enhancements for `RelatedInstanceSpecification`

* Doc enhancements for `RelationshipPathSpecification`

* Add docs for `RepeatableRelationshipPathSpecification`

* Move `MultiSchemaClasses` learning snippet test into `CommonRules.test.ts`. Add a result image for it.

* Move common rule docs into presentation docs root to avoid having to provide an index for them

* Update docs/presentation/RelatedInstanceSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RelatedInstanceSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Remove unused `chai-string` dependency

* Update full-stack-tests/presentation/src/learning-snippets/CommonRules.test.ts

Co-authored-by: Robert Lukasonok <[email protected]>

* Extend the recursive relationship step step example

* Attempt to clarify `count: "*"`

* Restore unintentional changes

* Restore unintentional changes

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

* Update docs/presentation/RepeatableRelationshipPathSpecification.md

Co-authored-by: Robert Lukasonok <[email protected]>

Co-authored-by: Robert Lukasonok <[email protected]>

* implement clonePartialCurve for B-splines (#3294)

* addKnot, clone refactor

* impl Bezier/Bspline clonePartialCurve

* clone narrow, knot bracket/normalize, offset tests

* lint: CurvePrimitive.clone() narrowing

* missed a narrow

* missed another narrow

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Use relative links instead of $docs syntax (#3291)

* Use relative links instead of $docs syntax

* Fix bad merge

* Support unquantized vertex tables (#3288)

* Remove obsolete unused BingElevation-based terrain.

* MeshPointList

* Option to quantize positions.

* Simplify graphic args pt 1: delete MeshGraphicArgs.

* Get stuff (mostly tests) compiling.

* Clean up (to an extent) MeshArgs and PolylineArgs. Tests are annoying.

* remove obsolete TODO.

* Quantized vertex table builders.

* unquantized vertex table builders.

* Mesh/PolylineArgs.points doesn't need an add method.

* Vertex comparison tolerance based on quantization params or chord tolerance.

* fix dumb test.

* fix a couple tests.

* fix vertex comparison.

* Clarify feature index is 24 bits and material index is not produced by frontend code.

* indentation

* ShaderBuilderFlags is an object.

We will need max rgba per vertex shortly.

* Read vertex table data up front.

* Use pre-sampled data for position.

* Use pre-sampled data for normals and color index.

* Use pre-sampled vertex data everywhere.

* Support decoding unquantized vertex position.

* Point3dList.range; qparams can be used for deriving range even if positions are not quantized.

* Flag specifying whether positions are quantized.

* consolidate normal computation.

* When reading vertex data conditionalize based on whether positions are quantized.

* Decode unquantized polyline/edge endpoints.

* PolylineTesselator.

* Turn on unquantized positions for decorations.

Test failures ensue.

* fix 3 tests.

the rest of the failures are from rendering.

* Test for unquantized vertex table (failing).

* Get test passing.

* unquantized geometry now renders correctly.

* update TODO. Probably won't address.

* Define unquantized positions relative to center of range.

* Update test.

* extract-api

* lint....

* please build my code.

* 3.2.0-dev.2

* 3.2.0-dev.3

* 3.2.0-dev.4

* 3.2.0-dev.5

* Reimplement deprecated getViewThumbnail function to resolve regression (#3306)

* Reimplement deprecated getViewThumbnail function to resolve regression

* allow LineString3d.clonePartialCurve() to extend the instance (#3315)

* allow extending LineString3d in clonePartialCurve

* testing, narrowing

* 3.2.0-dev.6

* Fixed issue that would close the new maplayer dialog when a new layer type was picked. (#3313)

* Fixed issue that would close the new maplayer dialog when a new layer type was picked.

* No need to resume outside click handling  when the whole panel is unloaded.

* changelog

* Fix background base color (#3318)

* 3.2.0-dev.7

* Improved validation of ESRI services before adding map layer (#3321)

* Validate  ESRI service supports 'Map' requests before making further tile requests.

* changelog

* Allow UI to initialize to old interface (#3322)

* Allow initial UI version to be set when UIFramework is initialized

* Rush change and add note about testing 1.0 mode.

* fix typo in ui-test-app

* Control active model/category in display-test-app (#3323)

* Fix 'ResizeObserver loop limit exceeded' error in MapLayers widget (#3305)

* Replaced useResizeDerector by UseLayoutResizeObserver

* changelog

* fixed CSS typo

* 3.2.0-dev.8

* Presentation: Customization rules documentation improvement (#3267)

* Update StyleOverride rule docs

* Update LabelOverride rule docs

* Update ImageIdOverride rule docs

* Update CheckBoxRule docs

* Add way to customize tree node items in data provider

* Deprecated some customization rules and corresponding node properties

* Add learning snippets for customization rules

* Add example snippets for SortingRule attributes

* Add example snippets for InstanceLabelOverride rule attributes

* Add example snippets for ExtendedDataRule attributes

* Restructure customization rules docs index

* Deprecated Item.imageId property

* Add docs for ExtendedDataRule usage

* Cleanup ExtendedDataUsage docs

* Add example images

* Fix node order check in hierarchies test

* Add links to attributes table

* Deprecate showImages attribute

* Make types referenced comment into links

* Sort imports

* Commit missing snapshot

* Fix typo in ExtendedDataRule ruleset snippet

* Fix typo

* Update instance label override class attribute snippet

* Fix identation

* Remove unnecessary suggestion to use InstanceLabelOverride

* Add more links to extended data usage page

* Update callouts in example images

* Improve sorting rule required schemas example

* extract-api

* Fix typos

* Fix typo

* Fix ruleset description

* Add better examples for disabled sorting rule

* Remove remark

* Rush change

* Add illustrations for requiredSchemas attribute

* Improve condition result value column naming

* Add missing comma

* Fix test

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Remove limit for categories query in display-test-app (#3310)

* up  limit for categories

* removed limit altogether

* Presentation: Fix paged request result accumulation (#3329)

* Avoid infinite loop when building paged requests response

* Rush change

* Update presentation/frontend/src/test/PresentationManager.test.ts

Co-authored-by: Grigas <[email protected]>

Co-authored-by: Grigas <[email protected]>

* return 404 status in RPC when iModel is not open (#3330)

* return 404 status in RPC when iModel is not open

* change

* remove redundant throw

* remove unused import

* Tools for modifying path/region geometry. (#3335)

* Tools for modifying path/region geometry.

* extract-api

* 3.0.2 changelogs (#3336)

Co-authored-by: imodeljs-admin <[email protected]>

* 3.2.0-dev.9

* Expose iTwin.js Core Version for extensions/embed-api (#3287)

Co-authored-by: Arun George <[email protected]>

* @bentley/imodeljs-native 3.2.0

* Pin reality-data-client to 0.7.0 due to bug in 0.7.1

* use relative links for md-> md linking

* Fix DisplayStyleState.changeBackgroundMapProvider (#3346)

* 3.2.0-dev.10

* 3.2.0-dev.11

* 3.2.0-dev.12

* BriefcaseConnection.activeSettings (#3341)

* Clean up nextversion.md

* Provide API to detect integrated graphics (#3324)

* first cut

* comment.

* NextVersion

* comment

* rush change

* rush extract-api

* Clean up changelog; add sample code.

* beta -> public

* fix doc link

* Add testing. Also tweak integrated detection logic - unmasked vendor is unreliable.  Detect Iris differently to work for cases in the wild.

* simplify conditional to test integrated.

Co-authored-by: Paul Connelly <[email protected]>

* disable lint warning for deprecation

* Merge with master

* rush change

* 3.2.0-dev.13

* initial Webpack 5 support (#3320)

Co-authored-by: Arun George <[email protected]>

* ColorDef validation and ColorByName fix (#3360)

* ColorByName is an object not an enum

Add ColorDef validation.

* Test ColorDef.getName

* docs, types.

* lint, extract-api

* NextVersion.md

* why aren't integration tests running?

* so much casting.

* 3.2.0-dev.14

* @bentley/imodeljs-native 3.2.1

* 3.2.0-dev.15

* @bentley/imodeljs-native 3.2.1

* Remove dependency on sprite loader (#3369)

* WIP

* WIP

* Remove all sprite references from ui-items-providers-test

* Testing for IconComponent web component icons
Change IconComponent tests to react-teating-library
Remove unused code from IconComponent

* use import statement to load local svgs

* Remove sprite usage from teh core packages
Deprecate sprite functionality

* rush change

* Remove  most sprite reference from ui-test-app,
leaving some in for test coverage.

* Extract-api

* correct doc typo

* Edit docs for clarity.

* Fix lint errors
Update NextVersion with deprecations

* Doc correction

* Fix length in getWebComponentSource

* Fix bad docs links

* Fix UI provider bug and add new provider param to isSupportedStage callback (#3377)

* fix bug where the wrong number of parameters were being passed

* fix missing parameter in provide widgets

* rush change

* 3.2.0-dev.16

* Presentation: Fix tile links in the documentation index page (#3372)

* @bentley/imodeljs-native 3.2.1

* small comment change

* Improve custom property value renderers' docs (#3370)

* Add the ability to skip the cross origin check (#3385)

* Add the ability to skip the cross origin check

Update imageElementFromUrl and tryImageElementFromUrl to have a new optional parameter (default false) that when set to true will skip the cross origin check when loading the image.

* Document API changes.

* extract-api

* 3.2.0-dev.17

* 3.2.0-dev.18

* 3.2.0-dev.19

* Provide an error message when IModelHost.hubAccess is undefined (#3391)

* bump to [email protected] (#3376)

* bump to [email protected]
* move form `onKeyPress` to `onKeyDown`

Co-authored-by: Arun George <[email protected]>

* 3.2.0-dev.20

* Remove 2.x extension api (#3353)

* kill off old extension api

Co-authored-by: Arun George <[email protected]>

* Fix for 3 new vulnerabilities. React to new @types/react version (#3399)

Update to fix a few build issues in the ui packages with new @types/react version.

Fix for 3 new vulnerabilities:

- minimist has a new vulnerability for the older versions of the package. Update display perf test app to the latest version of chrome-launcher to fix.
- node-forge has two new CVEs (here and here) and is a transitive dependency of webpack-dev-server and react-scripts. Unfortunately webpack-dev-server is locked down to a specific version of the selfsigned package, the package with a dependency on node-forge, which is on an old major version of the node-forge. The only way to fix this would be to either fork webpack-dev-server (which we don't want to do) or update to react-scripts@5 that is on the latest version.
- faker.js, a dev dependency used for testing, that is consumed by the presentation tests. There is no current fix so it has been added to the excluded list.

Co-authored-by: bsteinbk <[email protected]>

* Show usage of itwin UI Menu and Dropdown menu in place of core-react ContextMenu (#3293)

* Allow default tool to be started on frontstage activation even if a defaultTool is not specified in stage

* working on using itwinui's menus to replace core-react components.

* Reinstate a couple boxshadow variables use in DatePicker.

* Deprecate ShowHideMenu used in deprcated table

* Add appendTo="parent" to DropdownMenu specification

* Add NextVersion entry about deprecations.

* 3.2.0-dev.21

* Make it easier to override display-test-app configuration. (#3400)

* Make it easier to override display-test-app configuration.

* clarify.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Presentation: Learning snippets cleanup (#3386)

* Move `printRuleset` function into a shared utils file

* Split learning snippets into separate files

* Prefix all learning snippets with `Presentation.` to avoid collisions with non-presentation snippets

* Fix mixed up content specification learning snippets

Co-authored-by: Michael Belousov <[email protected]>
Co-authored-by: Michael Belousov <[email protected]>
Co-authored-by: Michel D'Astous <[email protected]>
Co-authored-by: MarcBedard8 <[email protected]>
Co-authored-by: Arun George <[email protected]>
Co-authored-by: imodeljs-admin <[email protected]>
Co-authored-by: Arun George <[email protected]>
Co-authored-by: GerardasB <[email protected]>
Co-authored-by: Spencer Barnes <[email protected]>
Co-authored-by: Caleb Shafer <[email protected]>
Co-authored-by: kckst8 <[email protected]>
Co-authored-by: Bill Goehrig <[email protected]>
Co-authored-by: Grigas <[email protected]>
Co-authored-by: Paul Connelly <[email protected]>
Co-authored-by: Bill Steinbock <[email protected]>
Co-authored-by: Seamus Kirby <[email protected]>
Co-authored-by: Robert Lukasonok <[email protected]>
Co-authored-by: dassaf4 <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: williamkbentley <[email protected]>
Co-authored-by: Saulius Skliutas <[email protected]>
Co-authored-by: MarcNeely <[email protected]>
Co-authored-by: Paulius Valiūnas <[email protected]>
Co-authored-by: bbastings <[email protected]>
Co-authored-by: markschlosseratbentley <[email protected]>
Co-authored-by: AJMigliore <[email protected]>
Co-authored-by: NancyMcCallB <[email protected]>
Co-authored-by: Travis Cobbs <[email protected]>
Co-authored-by: mgooding <[email protected]>
@audetto
Copy link

audetto commented May 5, 2023

Are there any news on possible solutions?

@vmoroz
Copy link
Member

vmoroz commented May 5, 2023

@audetto , it was discussed today in the Node-API meeting.

Since now we have the Node-API versioning PR #45715 merged, I am going to continue working on the PR #42651.
The plan is to change behavior of all Node-API finalizers starting with Node-API version 10. (The version 9 is going to be cut soon.) The new behavior will run finalizers as soon as they are called by GC. They will be not able to execute any JS-related code. There will be a new function node_api_set_immediate to execute JS related code in the next uv_loop tick.
Any finalizers that require JS code execution will be able to use this function from the finalizers. This way they can simulate the current behavior. Obviously, this plan can be changed while we work on it.

Today the only solution that works is using Promises. They enable the finalizer execution in the event loop and the app can avoid huge spikes in unreleased native objects.

@audetto
Copy link

audetto commented May 6, 2023

Sounds good. Thanks for the update.

@mhdawson
Copy link
Member

mhdawson commented Oct 6, 2023

With the landing of #1140, this issue should be resolved if you test against the Node.js nightly and turn on NAPI_EXPERIMENTAL. If your addon makes callbacks to JavaScript you may need to update it to use the new node_api_post_finalizer method.

Could you test that out to confirm it will address the issue you saw.

@audetto
Copy link

audetto commented Oct 29, 2023

Very good.

I have removed all await and stuff and now I can see the finalizer being called during the execution.
The only thing I did was to define NAPI_EXPERIMENTAL. Everything has worked even via node_addon_api which I dont think need to care about it.

Moreover I am calling this function in the finaliser: napi_adjust_external_memory and I can see it working as well.

So thumbs-up from me.

@KevinEady
Copy link
Contributor

Closing this as resolved via #1593

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

No branches or pull requests

6 participants