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

Error in worker when restoreState is invoked while state already exists #30

Closed
timblakely opened this issue Apr 19, 2017 · 1 comment
Closed
Labels

Comments

@timblakely
Copy link
Contributor

Spinning up a local instance and going to this link works. However, changing the state without a full refresh (e.g. removing least significant digit of zoomFactor) causes the following error:

backend.ts:26 Uncaught TypeError: Cannot read property 'visibilityCount' of undefined at RPC.<anonymous> (backend.ts:26) at RPC.target.onmessage.e (worker_rpc.ts:104)

It appears it's coming from this line in the shared visibility code. Discovered this while trying to do Viewer.state.restoreState with a modified state.

Possibly related: inspecting RPC.objects after restoreState shows that there are a number of duplicate entries for SharedUint64DisjointSets and Uint64Sets. Not sure if that's intended

jbms added a commit that referenced this issue Apr 19, 2017
…ence count

PerspectiveViewSkeletonLayer and SliceViewPanelSkeletonLayer both expect to be transferred ownership
of a reference to the SkeletonLayer object.  However, previously the calling code in
SegmentationUserLayer only had a single owned reference which was "transferred" twice.

This fixes issue #30.
@jbms
Copy link
Collaborator

jbms commented Apr 19, 2017

Thanks for reporting this. It turned out to be due to a reference counting bug. Unfortunately the reference counting in Neuroglancer is tricky to get right because Javascript doesn't permit smart pointers, move semantics, etc. like in C++. It might be possible to use identity type aliases to make things a bit more self-documenting --- not sure if that would cover all of the cases though. There also aren't really any unit tests of the reference counting.

@jbms jbms closed this as completed Apr 19, 2017
@jbms jbms added the bug label Apr 19, 2017
thejohnhoffer pushed a commit to Rhoana/neuroglancer that referenced this issue Oct 23, 2017
Integrate cMesher with main python setup.py install command.

Resolves google#30
thejohnhoffer pushed a commit to Rhoana/neuroglancer that referenced this issue Oct 23, 2017
* feat:add swc parsing

New decoder for parsing swc files into vertices and indices needed for skeleton rendering
Includes simple tests. tslint and formatting have been run.

* refactor: use custom Signal implementation in place of js-signals package.

The new implementation avoids memory copying on signal dispatch.

* feat(brainmaps): support changestacks for meshes

* chore: upgrade webpack dependency to 2.2.0

* refactor: use new CancellationToken mechanism

* style(memoize): use unique 'type' key for all uses of chunkManager.memoize.getCounted

* feat(brainmaps): display project labels in completion list

* refactor: add new more flexible state tracking mechanism

This replaces the old url_hash_state module with a much more flexible system that will also support
synchronization of state between multiple clients and with a Python server.

* perf(brainmaps): use lower jpeg quality to reduce image size

* feat: allow XYZ voxel coordinates to be pasted

A fairly liberal pattern is used to match XYZ coordinates in the pasted text.

Additionally, this factors the clipboard handling code out of main.ts.

* fix(render): Ignore stacks that are not in the COMPLETED state.

Stacks in the loading state are missing some parameters, and will cause the stackAndProject completer to fail.

* fix(dependent-project): properly import layer modules in dependent project's main.ts

This fixes the regression introduced in 453c5ef.

* refactor: factor default viewer setup out of main.ts

This is intended to make the dependent project example (and dependent projects that override the
main.ts entry point) more maintainable.

* refactor: specify supported user layers in the build configuration

The list of supported user layer types is now specified in the build configuration rather than in
default_viewer_setup.ts.

* feat(render): Support multi-scale chunks.

The Render datasource now computes a hierarchy of chunks by dividing the maximum voxel bound by 2 until the size of the requested chunk is smaller than a single tile dimension. This allows neuroglancer to leverage renders caching of Image+ objects and prevents neuroglancer from saturating the render server with requests at higher resolutions.

* feat: added verifyOptionalInt to json utils.

* feat(render): Accept a tilesize parameter.

Allows the user to modify the Render tilesize to best match their underlying images being transformed and served by render.

* docs: document the precomputed datasource

* chore: fix build under TypeScript 2.2

* basic py3 compatibility tweaks

* docs: add documentation of on-GPU hashing and chunk management system

* Code cleanup for PR google#21

* Small format fix for google#21

* feat(perspective_view): support translation via shift+mouse drag

* perf(navigation_state): avoid unnecessary temporary variable.

* docs: add links to related projects in top-level README.md

* feat(segmentation_user_layer): support toggleable "hide segment 0" option

Previously, voxels labeled with segment ID 0 displayed transparently by SegmentationRenderLayer,
rather than with a color like other segment IDs, under the assumption that segment ID 0 corresponds
to "unlabeled" or "background" voxels.

This change adds a checkbox to the dropdown menu for segmentation layers for toggling this special
treatment.

* Refactor: Generic SliceViewChunk and SliceViewChunkSource

By refactoring the VolumeChunkSource out of the SliceView code, we can create multiple spatial chunk sources similar to the existing VolumeChunkSource, but containing different data.

* Refactor: Moved ChunkFormat from SliceView to SliceView/Volume

ChunkFormat is specific to VolumeChunks, which render chunk data directly to textures.

* Feat: Cross-sectional view for chunks containing vertex positions.

The PointChunk and associated machinery allows for a chunk containing a list of vertex positions. These vertex positions are then rendered in the cross-sectional view using the existing slice view machinery, but with a custom draw function (currently using gl.drawArrays). This code allows overlaying points, vector fields, and arbitrary 2D polygons on top of imaging and/or segmentation data.

* style: tslint and formatting errors

* Fix: Properly autocomplete projects and stacks.

Previously stacks with the same name and different projects were considered the same stack. In addition to fixing autocomplete, this commit adds functionality to support multiple comma separated URLs to allow for hostname sharding.

* Fix: Update ndstore datasource to use new url format

The openconnectome datasource continues to use /ocp/ca for compatibility with openconnecto.me. The ndstore datasource has been updated to use /nd/sd, which is compatible with all other ndstore instances currently in production use. Additionally, a neariso parameter has been added to the path, allowing the user to disable neariso for ndstore instances that do not have neariso tables generated [yet].

* Feat: Added numlevels parameter to render datasource.

Allows the user to disable computing a levels hierarchy for projects that do not have generated mipmaps.

* feat(npy): handle signed integer types (treat as unsigned)

Previously signed integer types were not supported at all.  This simple fix handles the most common
use cases.

* feat(python): support skeletons and custom vertex attributes

* Update brainmaps datasources to use new binary endpoints. Since the new binary endpoints respect the "Accept-encoding: gzip" header, decoding in javascript via pako is no longer necessary.

* fix(brainmaps): correctly handle HTTP 403 errors

Also correctly handle empty volume and project lists.

* Reorder classes to avoid compile error in dependent project

* fix(brainmaps): fix regression in skeleton support.

This regression was caused by 78c4f0c.

* fix(skeleton): remove spurious call to console.log

* Update skeletons to use new endpoint (requires backend redeployment)

* refactor: moved chunkBytes to be member of PointChunkSource rather than spec.

* style: fixed formatting

* fix(brainmaps): retry requests on HTTP 504 errors

* Updated dvid datasource handlers to use new compression and jpeg endpoints. Ran clang and tslint to verify correct style.

* Added options to hide certain UI elements

* Refactor: Move source management renderlayer code into generic sliceview class.

The backend renderlayer classes in point (vectorgraphics) and volume simply override the sources member and use the default SliceView RenderLayer constructor. The frontend classes work similarly. In addition, some volume specific code was removed from Volume/RenderLayer and placed in SliceView/RenderLayer

* style: remove extra console.log and linting

* Feat: Generalized point code to arbitrary vector graphics.

Refactored and added functionality to allow for points and arbitrary polylines in the vector graphics chunk and rendering code.

* test(webgl): use TRIANGLE_FAN rather than POINTS for fragment shader testing

POINTS does not seem to work for this purpose on Windows.

* fix(perspective_view): make transparency work in Chrome on Windows

Reusing the same WebGLFramebuffer (with separate color buffers) for both the regular rendering pass
and the transparent rendering pass resulted in the second color buffer not being properly written in
Chrome on Windows.  While the exact cause of this is unknown, using a separate Framebuffer solves
the problem.

* fix(segmentation_user_layer): correct handling of SkeletonLayer reference count

PerspectiveViewSkeletonLayer and SliceViewPanelSkeletonLayer both expect to be transferred ownership
of a reference to the SkeletonLayer object.  However, previously the calling code in
SegmentationUserLayer only had a single owned reference which was "transferred" twice.

This fixes issue google#30.

* Fixes for TS 2.3.1

* fix(dvid) use dvid datainstance endpoint for extents

MinPoint/MaxPoint will soon be removed from the /repos/info endpoint.
Instead, makes an extra api call on the datainstance to get extents

* tslint/clang fixes

* chore: require typescript version 2.3

* fix(chunk_manager): fix serious memory leak.

Previously, chunks transferred into the frontend thread were never freed, due to the branches of an
if statement being reversed, with the consequence of memory growing without bound.

* fix(dvid) code review fixes: added enum for dvid volumeChunk encoding and removed extra property

* perf(vector_graphics): Use instancing to reduce GPU copies

By using instancing in the vector_graphics_renderlayer when drawing lines we reduce the number of items required to be copied to the GPU to essentially just the start and end point coordinates of each line.

* Refactor: Moved line-specific vector graphics code to line_renderlayer.

The generic vector graphics renderlayer contains code for rendering a generic vector graphics primitive (e.g. polyline, point, etc). The line renderlayer contains specialized shaders and related code for rendering anti-aliased lines.

* docs: Added documentation for vector graphics layer rendering

* Feat: Added point match request to render backend.

Uses the render point match database to request point matches for a given z-slab. The point matches are rendered using the new vector graphics line render layer.

* style: lint and formatting

* Feat: Trackable finite float

For tracking primitive sizes in vector graphics layers

* Fix: properly restore primitive size for vector graphics renderlayers

* refactor: moved vertexIndex and normalBuffer bindings outside of draw loop

* style: formatting and typos

* fix(layer_panel): Permit the layer panel to wrap to multiple lines.

* refactor: refactor disabling of context menu out of viewer.ts

* Refactor(vectorgraphics): rename primitiveSize, remove trackableFragment, rename feather

primitiveSize has been renamed to lineWidth, as the value is likely specific to lines. Feather has been renamed antialiasing, to more accurately describe its function. Trackable fragments have been removed for the vector graphics user layer -- editing the fragment code is likely to caue backwards compatibility issues in the future.

* Fix: Typos in error message

* Fix(vectorgraphics/line): remove unnecessary case from fragment shader, formatting

* Feat: Track RGB color values for vector graphics render layers

The TrackableVec3 class and Vec3 entry widget allow the user to input a vec3 triple in the layer dropdown. The vec3 entry widget provides a text input for each vec3 value with a verification and update method that can be overloaded to sanitize user input. For example, the vector graphics line renderlayer expects a vec3 in the range [0,1], but due to floating point string conversion it is more user friendly to provide a series of RGB values in the range [0,255]. So, the VectorGraphicsColorWidget extends the Vec3Widget to convert the user input from the range [0,1] to [0,255] and ensure the user only sees values in [0,255], even though the tracked vec3 element is in the range [0,1].

* Fix: Primitive size -> line width

* Refactor: Identify vector graphics render layers by primitive type

Rather than identifying all vector graphics render layers as a generic 'vectorgraphics' type, we identify layers as lines, points, vectors, etc. Currently only lines are supported with point support in development, but adding additional layer types only requires updating the enum and the vector_graphics_user_layer.

* style: tslint and format

* refactor: Rename VECTOR_GRAPHICS_LAYER_TYPE to VectorGraphicsType

Better matches existing type terminology (e.g. VolumeType)

* perf(datasource/render): Simplify loading of point matches into chunks

* style: tslint

* feat(webgl): display error message if WebGL is not supported.

* refactor(keyboard_shortcut_handler): refactor keyboard handler stack into class

Also adds priority value associated with each handler, and replaces GlobalKeyboardShortcutHandler
class with a simple method that returns a disposer.

* chore(tsconfig.json): set noUnusedLocals to true

* feat: Add Viewer-level prefetching support.

A new `visibility` option can be specified when constructing a viewer.  It specifies that the viewer
is either visible (a value of +inf), ignored (a value of -inf), or invisible but prefetched (any
integer).  If invisible but prefetched, the DOM tree is still created (but with 'hidden' visibility)
in order to accurately determine the panel dimensions (which affects loading of data), but all chunk
requests are made with the specified prefetch priority.  Prefetch chunks have lower priority than
visible chunks, and among prefetch chunks the ordering is based on the lexicogrpahical ordering
of (prefetchPriority, chunkPriority).

The chunkQueueManager, chunkManager and worker have been factored out of Viewer and into a
DataManagementContext class.  To share the same DataManagementContext between multiple Viewer
instances, specify an explicit `dataContext` option when constructing the Viewer.  This is
particularly useful in conjunction with prefetching.

* chore: update clang-format version

* style: fix unused variable lint errors.

* style: fix formatting, remove extra semicolons

* chore: enable no-extra-semi lint rule

* Use 'dtype=np.float32' instead of 'float' for np.zeros()

This fixes

  TypeError: 'float' object cannot be interpreted as an index

* fix(viewer): only show layer dialog if the viewer is visible

* Fix: Return an array from getVisibleLayers instead of an iterator

* feat(brainmaps): add encoding "querystring" parameter for volumes

The encoding can be specified using a volume source URL of the form:

brainmaps://a:b:c?encoding=raw

Currently this parameter can only be used to specify an encoding of raw for volumes that would
otherwise be retrieved with JPEG encoding (single-channel uint8 volumes displayed as images rather
than segmentations).  The raw encoding results in greater data transfer over the network but avoids
artifacts introduced by the JPEG encoding when the shader-defined mapping from values to colors is
discontinuous (e.g. thresholding, or mapping certain values to specific colors).

* fix(sliceview): properly pass shaderError object

This fixes a regression introduced by 7ccd046, which also prevented
building with the Closure Compiler.

* fix: make SliceViewPanel and PerspectivePanel resize handling more robust.

For various reasons the client area of a panel may change without a resize event.  This resulted in
drawing sometimes being done with the wrong dimensions, resulting in certain artifacts.  This is
avoided by always checking for a possible resize prior to drawing.

* docs(image_layer_rendering): Add note about avoiding lossy compression artifacts

* fix(VisibilityPriorityAggregator): permit duplicate registrations

This changes the interface (by removing the `remove` method) to support duplicate registrations of
the same WatchableVisibilityPriority.

This fixes a bug (which could occur when switching between layouts in the case that a skeleton layer
is present) due to potential duplicate registration by VisibleRenderLayerTracker.

* Increase visibility of some private members

* fix(python): avoid duplicate-decl-specifier warning

* fix: support typescript 2.4

This fixes one actual runtime bug and improves the type annotations to fix type check errors caught
by Typescript 2.4.

* chore: change dependent-project example Typescript dependency

* chore: upgrade webpack dependency

* fix(viewer): Make DataManagementContext and Viewer properly disposable

* chore: fix some lint warnings

Some lint errors remain due to bug in tslint's shadowed variable detection regarding temporal dead
zones.

* Increase visibility of `segmentColorShaderManager`

* Integrates backs google/neuroglancer changes.

State server -> checked from client to server
check segmentation is being displayed correctly -> checked
signals are being propagated -> checked
check semantic mode works -> checked
Merging and splitting signals -> checked
Shattered -> checked
Skeletons <- Not checked:
requires extending SkeletonSource from python/neuroglancer/skeleton.py
Synapses <- checked
Points <- checked
Vector fields < Not checked:
The only backend that supports it seems to be https://github.com/saalfeldlab/render
Changes visible to the user:

It's now possible to overlap points, vector fields, and arbitrary 2D polygons on top of imaging and/or segmentation data.
Functionality to support multiple comma separated URLs to allow for hostname sharding.
Better support for skeletons
Support for pre-fetching chunks outside the viewport
Many bug fixes, including memory growing without bound which would crash the tab.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants