Comments (12)
OK, there are two problems here: at first I thought that wcsinit() had to be passed a larger value for hlength (max length to check for a header param in case END is not found, default 256000). But now I believe that the current hlength is fine in your case: all of the relevant header parameters are way before the 256000 byte limit. That is, even with this too-small limit, all params should be found correctly.
More problematic is the Emsripten stack limit problem:
emscripten-core/emscripten#11135
By default, Emscripten has a 5Mb stack limit. Strings are passed on the stack using 4 * string size + 1 bytes, so your 2.8Mb header requires > 10Mb of stack space and ... SEGV time.
I don't want to allocate a semi-infinite amount of stack space for the occasional huge size header FITS file, so I'm gonna have to figure out how to call wcsinit() more cleverly. Stay tuned ...
from js9.
Still a way to go, but the heap-passing technique is starting to look promising ...
from js9.
@Mulan-94 Hi Lexy, I'll need some more info, because below is a test image containing NaN values that loads correctly. If you have an image containing NaN values that crashes, could I please get a copy? Or, if you are using JS9.MaskImage(), can I get a copy of both the mask and the image being masked?
from js9.
@Mulan-94 Also, once we have a file that reproduces the problem, we'll need to know how the NaN values are made. I see that the Posix nan() call takes an argument and I just passed a NULL. Of course, there are other ways to make a NaN. Without any data whatsoever, I see two possibilities:
-
if the segv is happening in the CFITIO library, we can run the ftools fverify on the file, test against a CFITSIO desktop program, perhaps submit a bug report to HEASARC
-
if the segv is happening in Javascript, we'll want to make sure that the standard Number.isNaN() is handling your NaN values correctly, we might require a work-around.
from js9.
@ericmandel sorry just seeing this, I'm emailing you the image now
from js9.
When I open CYG-FPOL-FLO.FITS using JS9 (Desktop version), I get the following error:
And looking at the file, I see the header is really long: 2822400 bytes or 35280 80-byte header entries, almost all of it HISTORY keywords. Following wcslib defaults (and after long conversation with Jessica Mink, wcslib author), I set a max header size to 256000 bytes, or 3200 header entries.
I'm not sure what to do about this. Off-hand I forget what the trade-offs are for increasing the wcsinit max size and I will look into this. In the meantime, can you tell me if this is an anomaly or do you expect files header of this size typically?
cc: @o-smirnov
from js9.
I'm not sure actually, let's wait for @o-smirnov on this one
from js9.
@Mulan-94 @o-smirnov I've sent email to Jessica Mink (instead of walking over to her office, sigh), asking for advice on increasing the max header parameter. The relevant code looks benign, so I hope we will be able to do this. I'd probably try 5Mb or 10Mb to start ...
from js9.
Thanks for looking into this @ericmandel! That header is pretty excessive but, sadly, not exceptional for radio images produced by AIPS. It likes to be very verbose about its data processing history. So while we can easily work around it in each individual case, this is something that will continue to trip the unwary user...
from js9.
@o-smirnov @Mulan-94 That's fine, I have practically no experience with radio data and was hoping it was a mistake!
I just have to copy the header string to the Emscripten heap (and pass a pointer) instead of passing the string directly on the stack ... once I get that technique working, it should work forever ...
from js9.
@Mulan-94 @o-smirnov OK, we're all set and updated in GitHub. Thanks, Lexy, for pointing this one out, it was a very interesting bug!
from js9.
Great! and thanks @ericmandel for taking your time to look into it so quickly.
from js9.
Related Issues (20)
- Conflicting CSS HOT 3
- Loading files from the server with the node helper HOT 14
- Javascript API HOT 2
- Load multi extension tile compressed fits report error. HOT 9
- JS9.Load("file", {ra: 0, dec: 0}) doesn't pan HOT 3
- Missing reference in CSS file "tabcontent.css" HOT 3
- JS9 ERROR: cannot load: ../astroemw.wasm ... please check the url/pathname HOT 3
- Multi Extension FITs mosaic display HOT 12
- Fits Image Display Area + Rotation HOT 10
- JS9 potentially crashing on ARM64 architecture HOT 8
- JS9.ChangeRegions() to change position incorrect after zooming image HOT 5
- Incorporating JS9 (and pyjs9) into a JupyterLab -> Kubernetes/Docker system HOT 2
- Release with bundled minimist bump? HOT 3
- Q: is there a query parameters to load image from CORS server? HOT 16
- ImageOpts.flip does nothing HOT 3
- Load image from memory. HOT 4
- End of JS9 development: July 1, 2022 HOT 2
- Preload regions with image HOT 3
- unable to open some files HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js9.