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

[2.5D Map] Future #440

Closed
wolfgang-ch opened this issue Jan 6, 2022 · 13 comments
Closed

[2.5D Map] Future #440

wolfgang-ch opened this issue Jan 6, 2022 · 13 comments
Assignees
Milestone

Comments

@wolfgang-ch
Copy link
Collaborator

wolfgang-ch commented Jan 6, 2022

The 2.5D map has currently the following issue when using Eclipse > 2021-06 - MT is crashing

# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000003969d18d4, pid=11704, tid=9484
#
# JRE version: OpenJDK Runtime Environment Temurin-11.0.13+8 (11.0.13+8) (build 11.0.13+8)
# Java VM: OpenJDK 64-Bit Server VM Temurin-11.0.13+8 (11.0.13+8, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C  [vtm-jni64.dll+0x18d4]
#

---------------  T H R E A D  ---------------

Current thread (0x00000154f2f83800):  JavaThread "LWJGL Application" [_thread_in_native, id=9484, stack(0x00000001a7100000,0x00000001a7200000)]

Stack: [0x00000001a7100000,0x00000001a7200000],  sp=0x00000001a71fecf0,  free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [vtm-jni64.dll+0x18d4]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.oscim.renderer.GLMatrix.set(J[F)V+0
j  org.oscim.renderer.GLMatrix.set([F)V+26
j  org.oscim.map.ViewController.setViewSize(II)V+54
j  org.oscim.gdx.GdxMap.create()V+140
j  net.tourbook.map25.Map25App.create()V+1
j  com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop()V+29
j  com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run()V+27
v  ~StubRoutines::call_stub

siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), writing address 0xffffffffecc07960

This issue is also discussed in https://groups.google.com/g/cruiser-users/c/bq3cXl9_ZvM where another app has the same issue. According to this discussion, this issue can may be fixed when the source is recompiled.

According to Emux words, who is currently the main VTM contributor, he is not planning to fix this issue in the near future

Emux: "There are no plans to change VTM compile, as it has to work on Android."
https://groups.google.com/g/cruiser-users/c/bq3cXl9_ZvM/m/FcA1f3bUBAAJ

When this issue is not fixed, then we are trapped with Eclipse 2021-06.

I've too few skills to fix/debug this issue, the source is in https://github.com/mapsforge/vtm/tree/master/jni

@wolfgang-ch wolfgang-ch changed the title [2.5D Map Future] [2.5D Map] Future Jan 7, 2022
@wolfgang-ch
Copy link
Collaborator Author

wolfgang-ch commented Mar 3, 2022

I could recompile the vtm-jni64.dll file, the released version still works with the new dll :-) but this exception is not yet solved, MT is still crashing when running from the IDE

Red: new dll
Green: old dll

image

@telemaxx
Copy link
Contributor

telemaxx commented Mar 3, 2022

good job. @wolfgang-ch: have you compiled it with ant?

the crash when running from ide is not new. that was occurring on windows since a while.
that was the reason that i installed linux for developing.

wasnt it the problem, to build MT with a newer eclipse, necessary for the dark theme?

have you tried to build MT with a new eclipse?
does that build also crash when directly started without ide?

@wolfgang-ch
Copy link
Collaborator Author

wasnt it the problem, to build MT with a newer eclipse, necessary for the dark theme?

no

have you tried to build MT with a new eclipse?

no, I don't expect that it will work

does that build also crash when directly started without ide?

I don't know, I tested the build with Eclipse 21-06 and this worked

@wolfgang-ch
Copy link
Collaborator Author

Since my last commit 86dab61, a week ago, I try to setup a dev environment to build vtm-jni64.dll which I succeeded the day before yesterday :-)

I discovered, that the build script build-windows64.xml existed in the the commit 59ab24d from 2014-09-20 but was deleted the commit afterwards. So I tried to build vtm-jni64.dll with the last existing build-windows64.xml, I could compile it (with some adjustments) but the linker failed which I could not solve. So I decided to use the last commit we are currently use in MT e62e27c from 2021-05-27

With /jni/src/JniBuilder.java the file build-windows64.xml can be created but it needed some adjustments that the build did finally worked

The good news is, that this created .dll is working as the old .dll but now the investigations start, to find the reason why it's still crashing

I save my dev tests in this branch https://github.com/mytourbook/vtm/commits/0.16_with_build-windows64.xml

My C/C++ environment:

  • Eclipse with C/C++ plugins, however I could not yet fix the include paths, it does not find the standard c includes but this is not a problem when running the build script
  • Cygwin64 with newest
    • mingw64-x86_64_gcc-core
    • mingw64-x86_64_gcc-g++

@wolfgang-ch
Copy link
Collaborator Author

wolfgang-ch commented Mar 4, 2022

With very useful hints from corretto/corretto-11#178 (comment) I could fix this exception in mytourbook/vtm@351183c :-) ...

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [vtm-jni64.dll+0x1978]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.oscim.renderer.GLMatrix.set(J[F)V+0
j  org.oscim.renderer.GLMatrix.set([F)V+26
j  org.oscim.map.ViewController.setViewSize(II)V+54
j  org.oscim.gdx.GdxMap.create()V+140
j  net.tourbook.map25.Map25App.create()V+1
j  com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop()V+29
j  com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run()V+27
v  ~StubRoutines::call_stub

siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), writing address 0xffffffffa86d78c0

... but now another exception occurs


Stack: [0x000000c0f0900000,0x000000c0f0a00000],  sp=0x000000c0f09fe6e0,  free space=1017k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [vtm-jni64.dll+0x7873]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.oscim.utils.TessJNI.addMultiContour2D(J[I[FII)V+0
j  org.oscim.utils.TessJNI.addContour2D([I[F)V+9
j  org.oscim.renderer.bucket.MeshBucket.addMesh(Lorg/oscim/core/GeometryBuffer;)V+45
j  org.oscim.layers.tile.vector.VectorTileLoader.renderArea(Lorg/oscim/theme/styles/AreaStyle;I)V+78
j  org.oscim.theme.styles.AreaStyle.renderWay(Lorg/oscim/theme/styles/RenderStyle$Callback;)V+6
j  org.oscim.layers.tile.vector.VectorTileLoader.renderWay([Lorg/oscim/theme/styles/RenderStyle;)V+19
j  org.oscim.layers.tile.vector.VectorTileLoader.process(Lorg/oscim/core/MapElement;)V+139
j  org.oscim.tiling.source.mvt.TileDecoder.parseGeometry(Ljava/lang/String;Lorg/locationtech/jts/geom/Geometry;Ljava/util/Map;)V+278
j  org.oscim.tiling.source.mvt.TileDecoder.decode(Lorg/oscim/core/Tile;Lorg/oscim/tiling/ITileDataSink;Ljava/io/InputStream;)Z+120
j  org.oscim.tiling.source.UrlTileDataSource.query(Lorg/oscim/layers/tile/MapTile;Lorg/oscim/tiling/ITileDataSink;)V+179
j  org.oscim.tiling.OverzoomTileDataSource.query(Lorg/oscim/layers/tile/MapTile;Lorg/oscim/tiling/ITileDataSink;)V+70
j  org.oscim.layers.tile.vector.VectorTileLoader.loadTile(Lorg/oscim/layers/tile/MapTile;)Z+142
j  org.oscim.layers.tile.TileLoader.doWork()V+24
j  org.oscim.utils.PausableThread.run()V+120
v  ~StubRoutines::call_stub

siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), reading address 0x000000007cc2fde0

@wolfgang-ch
Copy link
Collaborator Author

Could also fix the above reading address exceptions in mytourbook/vtm@7ac4f9b, it had the same problem, long -> jlong and now the 2.5D map is working in the Eclipse IDE 2021-12 :-))))

image

Finally, I will update the vtm plugin but you could test it already now by copying the new vtm-jni64.dll https://github.com/mytourbook/vtm/blob/7ac4f9b09a271507e42abee299ea3a1427765af1/jni/libs/windows64/vtm-jni64.dll?raw=true into the plugin natives folder https://github.com/mytourbook/mytourbook/tree/main/bundles/net.tourbook.ext.vtm.windows/natives, this is the way how I did the testing.

@FJBDev
Copy link
Collaborator

FJBDev commented Mar 4, 2022

and now the 2.5D map is working in the Eclipse IDE 2021-12 :-))))

👏 👏

@telemaxx
Copy link
Contributor

telemaxx commented Mar 5, 2022

was an interesting bug. good finding.

@wolfgang-ch
Copy link
Collaborator Author

When I started this rescue project for the 2.5D map, I didn't know how long it takes and if I will succeed.
The first 5 days, I needed to setup a dev environment to build the dll, luckily then it worked and I could create the "old" crashing dll.

Then was the question, how to fix it. I searched a lot in the internet until I found this corretto/corretto-11#178 (comment) issue and read the whole comment which is explaining why this exception happens.

With the classic printf statements (I could not debug it) I could see at which line the crash happens. With this additional lines in the build file
https://github.com/mytourbook/vtm/blob/bd66b2bc89bef4a4501eb3c8cc2d133cd0d1c686/jni/jni/build-windows64.xml#L181-L187 I could modify the code and build the dll within 2 seconds to test it afterwards.

For me it was like a "Heureka" when the first exception was fixed as it didn't look that I could fix it, but then, the second exception occurred. With the knowledge of the first fix, the fix for the second exception was easy, it was the same as the first and then the 2.5D map worked as years before in the IDE

I had some C skills from the 1980s when during my study, I helped a small company http://www.hellak.de/ to develop a mobile computer with a Z80 processor, 4x40 matrix display and membrane keyboard for the forester, to gather all data of harvested timber, e.g. wood, length, diameter,... I named this product HMC2000 but you cannot find anything about it in the internet.

@wolfgang-ch wolfgang-ch added this to the 22.next milestone Mar 6, 2022
@wolfgang-ch wolfgang-ch self-assigned this Mar 6, 2022
@wolfgang-ch wolfgang-ch added the Bug label Mar 6, 2022
@wolfgang-ch
Copy link
Collaborator Author

PR mapsforge/vtm#911 is merged into vtm project mapsforge/vtm@84ccf9d

@telemaxx
Copy link
Contributor

telemaxx commented Mar 7, 2022

When I started this rescue project for the 2.5D map, I didn't know how long it takes and if I will succeed. The first 5 days, I needed to setup a dev environment to build the dll, luckily then it worked and I could create the "old" crashing dll.

Yes setting up the ide and a successful first build is always a milestone for me.

Then was the question, how to fix it. I searched a lot in the internet until I found this corretto/corretto-11#178 (comment) issue and read the whole comment which is explaining why this exception happens.

i had read this comment also completely, it was really interesting.

For me it was like a "Heureka" when the first exception was fixed as it didn't look that I could fix it, but then, the second exception occurred. With the knowledge of the first fix, the fix for the second exception was easy, it was the same as the first and then the 2.5D map worked as years before in the IDE

for me i did not have much hope for a fix. i thought it would be a complicate 3D/GL problem.

I had some C skills from the 1980s when during my study, I helped a small company http://www.hellak.de/ to develop a mobile computer with a Z80 processor, 4x40 matrix display and membrane keyboard for the forester, to gather all data of harvested timber, e.g. wood, length, diameter,... I named this product HMC2000 but you cannot find anything about it in the internet.

My first computer had also a Zilog Z80a Processor. "Color Genie"
Bud programmed with basic and assembler...

@wolfgang-ch
Copy link
Collaborator Author

My first computer was a ZX81 followed by SV-328 and then I had the idea to create/build a board computer for my car. I did a lot of tests (with water) but was not able to measure the flow of petrol, it meashured every time a different value. But I could place a sensor at the speedometer, so I could display time, distance and speed.

I remember that the board computer was ready when we traveled to Portugal 1986, just after Tschernobyl havarie

Sadly there is no picture from the hardware, it had a 4 digit display and a few buttons.

This was circuit layout

IMG_9700

Keyboard / display features

IMG_9711

How to get a 1 second clock from the extreemly fast 4 MHz cpu clock :-)

IMG_9702

Counter for the distance

IMG_9703

Decoding memory

IMG_9704

Decoding I/O

IMG_9705

All was programmed with tons of assembler and all by hand. There was no multiply or division command in the Z80 but I could find such an assembler routine.

When the program started, it made a display test by displaying 88:88

IMG_9706

Routine to display 4 digits

IMG_9707

Routine to output one digit

IMG_9708

This was my cheat sheet with all Z80 commands

IMG_9709

IMG_9710

@telemaxx
Copy link
Contributor

telemaxx commented Mar 7, 2022

My first computer was a ZX81

my computer dealer had ZX81 and ColorGenie. i choosed the CG because i did not like the Keyboard from the Sinclair.
But the ZY81 was far more popular.
Anywhere, i was happy with CG.

Sadly there is no picture from the hardware, it had a 4 digit display and a few buttons.

you will never need it again, but youre heart hang on it.
i have some of my drawings in my parents house. i can not throw them away.
my cg is also there.

This was circuit layout

IMG_9700

the 8255 was a great chip 3* 8bit IO.

Keyboard / display features

IMG_9711

How to get a 1 second clock from the extreemly fast 4 MHz cpu clock :-)

twice speed of mine. 2,2Mhz

But i upgraded my one from 16KB to 32KB

All was programmed with tons of assembler and all by hand. There was no multiply or division command in the Z80 but I could find such an assembler routine.

when i saw youre program listening, i had a Dejavu.
one side the mashine code, one side the hex representation.

often i had failures, in my first job later i had a VMEBug for 68000.
there i could enter directly the code.

This was my cheat sheet with all Z80 commands

IMG_9709

this i had also ;-)

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

3 participants