10.2 Migration Issue

2738
16
12-09-2013 06:27 AM
StephenBaier
New Contributor III
I decided to migrate to 10.2 today, hoping it would be smooth and painless because my application doesn't do anything special - simply renders symbols on a graphics layer.

Note: I can run the sample applications without problems - so either the problem is in my project setup or my data. Would there be any reason a tile package that worked for 10.1.1 not work with 10.2?

This code creates the map, if it is commented out I don't receive be below error spewing, but it still seg-faults upon exiting the application.
ArcGISLocalTiledLayer tiledLayer = new ArcGISLocalTiledLayer("/path/to/map.tpk");
tiledLayer.setName("Nautical Chart");
getLayers().add(tiledLayer);


When I start my application (without the above code commented out), it starts continuously spewing:
Frame_buffer_OGL::init_ FAILED to create_ FramebufferName
Frame_buffer_OGL::init_ FAILED to create_ FramebufferName
Frame_buffer_OGL::init_ FAILED to create_ FramebufferName
Frame_buffer_OGL::init_ FAILED to create_ FramebufferName
...


When I close the application I get a core dump, regardless of the local tiled layer.

Any helpful hints?

More information:

When the application starts I get this information:
Java version : 1.7.0_25 (Oracle Corporation) amd64
Rendering engine : OpenGL
GLX version 1.4

glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GT 640/PCIe/SSE2
OpenGL version string: 4.3.0 NVIDIA 319.49
OpenGL shading language version string: 4.30 NVIDIA via Cg compiler

Core dump that occurs after closing application:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f2ed57f5ea9, pid=8724, tid=139829799008000
#
# JRE version: 7.0_25-b15
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.25-b01 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x709ea9]  Monitor::ILock(Thread*)+0x79
#
# Core dump written. Default location: /home/user/core or core.8724
#
# An error report file with more information is saved as:
# /home/user/hs_err_pid8724.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#
0 Kudos
16 Replies
ColinAnderson1
Esri Contributor
The crash on exit may be due to failing to call dispose on a JMap instance. In the latest release it is necesary to call dispose. If you look in the sample code you will see one way of doing this - disposing the JMap in the window closing event.
0 Kudos
StephenBaier
New Contributor III
The crash on exit may be due to failing to call dispose on a JMap instance. In the latest release it is necesary to call dispose. If you look in the sample code you will see one way of doing this - disposing the JMap in the window closing event.


Excellent! That fixes the core dump on exit issue. Now to just figure out why it never actually renders anything!
0 Kudos
StephenBaier
New Contributor III
I was doing some testing and accidentally discovered a janky workaround...

I was thinking that the only difference between the working samples and my application is that mine is built in Eclipse RCP with SWT, using an SWT-AWT bridge to contain the JMap:
// Create embedding composite
Composite comp = new Composite(this,SWT.EMBEDDED | SWT.DOUBLE_BUFFERED);
comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
comp.setLayout(new FillLayout());

// Create AWT container
Frame f = SWT_AWT.new_Frame(comp);
JApplet japp = new JApplet();
map = new ArcMap();                                   // extends JMap

// Add map to container
f.add(japp);
japp.add(map);
f.setVisible(true);


I decided to test my project by simply starting the Local Tiled Layer sample from inside my application. It worked! But all the more interesting... my map also worked! Therefore, somehow, when I start the Local Tiled Layer sample (which runs as a separate JFrame) from inside my application, it lets my JMap work (which is embedded in an SWT-AWT bridge JApplet).
// start workaround
LocalTiledLayer.main();

// add map dispose listeners
addDisposeListener(new DisposeListener() {
 @Override
 public void widgetDisposed(DisposeEvent e) {
  map.dispose();
  LocalTiledLayer.dispose();
 }
});

I have no clue whatsoever why this works... but it WORKS! The only modification I made to the Local Tiled Layer sample was to change the instance created by main() to a static attribute and added a static dispose() function to call when my application is done. If the sample application is disposed before my application is complete, my map reverts to spewing errors.

@See ESRI 10.2 Sample Code: Local Tiled Layer
0 Kudos
CarlosColón-Maldonado
Occasional Contributor III
I'm seen the same issue with a migrated application that has worked through 10.1.1 since version 1.0 of Runtime, but it only occurs on start-up and then it seizes. Does it have anything to do with the JOGL library dependencies been removed?
0 Kudos
CarlosColón-Maldonado
Occasional Contributor III
I was doing some testing and accidentally discovered a janky workaround...

I was thinking that the only difference between the working samples and my application is that mine is built in Eclipse RCP with SWT, using an SWT-AWT bridge to contain the JMap ...

I have no clue whatsoever why this works... but it WORKS!


I am not using SWT on my app but I'm still seeing this, so I want to see if it can work for me. Assuming that you're using org.eclipse.swt-3.1.jar on your sample app, how did you construct the Composite "comp" object? What is "this" being passed as parent Composite?
0 Kudos
StephenBaier
New Contributor III
I am not using SWT on my app but I'm still seeing this, so I want to see if it can work for me. Assuming that you're using org.eclipse.swt-3.1.jar on your sample app, how did you construct the Composite "comp" object? What is "this" being passed as parent Composite?


The ArcGIS map is embedded in an Eclipse RCP View Part, which is passed a Composite parent to its createPartControl interface. It would be quite tasking, unless you are already an Eclipse developer, to create this is a sample case. Another way of doing it is to just create an SWT window and build from that.

import org.eclipse.swt.*;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.*;

Display display = new Display ();
Shell shell = new Shell (display);

// insert stuff in shell

shell.open ();
while (!shell.isDisposed())
 if (!display.readAndDispatch ()) 
  display.sleep ();
display.dispose ();


The shell is a Composite you can add items directly to.
0 Kudos
CarlosColón-Maldonado
Occasional Contributor III
The ArcGIS map is embedded in an Eclipse RCP View Part, which is passed a Composite parent to its createPartControl interface. Another way of doing it is to just create an SWT window and build from that. The shell is a Composite you can add items directly to.


Thanks for replying quickly. I've seen the Display/Shell sample which, as you state, it is a pure SWT window. Unfortunately, I've been pure Swing on an already two-year development project, and I'm afraid throwing it a curve as such would cause more harm than good. I'm in favor of temporary workarounds so long as they are temporary, and I am yet to hear from ESRI as to what is the official prognosis. Until then, I'll keep subscribed here and see what happens.
0 Kudos
JeremieJoalland1
Occasional Contributor II
The crash on exit may be due to failing to call dispose on a JMap instance. In the latest release it is necesary to call dispose. If you look in the sample code you will see one way of doing this - disposing the JMap in the window closing event.


Colin,
Could you elaborate on this issue ?

I'm able to generate a JVM crash on exit by commenting the map.dispose() of type EXCEPTION_UNCAUGHT_CXX_EXCEPTION
I understand we have to dispose the map, but how commenting it could generate a fatal error ? fatal error should be rare... it doesn't feel right to be able to crash my JVM so easily, especially when my JMap is empty :

public class MapDisposeApp {

    private JFrame window;
    private JMap map;

    public MapDisposeApp() {
        window = new JFrame();
        window.setSize(800, 600);
        window.setLocationRelativeTo(null); // center on screen
        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        window.getContentPane().setLayout(new BorderLayout(0, 0));

        window.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent windowEvent) {
                super.windowClosing(windowEvent);
//                map.dispose();
            }
        });

        map = new JMap();
        window.getContentPane().add(map);

//        ArcGISTiledMapServiceLayer tiledLayer = new ArcGISTiledMapServiceLayer(
//            "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
//        map.getLayers().add(tiledLayer);
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
          
            @Override
            public void run() {
                try {
                    MapDisposeApp application = new MapDisposeApp();
                    application.window.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
}


Each time I run my app and close it I got :

Java version : 1.7.0_40 (Oracle Corporation) x86
Rendering engine : DirectX
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_UNCAUGHT_CXX_EXCEPTION (0xe06d7363) at pc=0x7c812fd3, pid=2132, tid=3644
#
# JRE version: Java(TM) SE Runtime Environment (7.0_40-b43) (build 1.7.0_40-b43)
# Java VM: Java HotSpot(TM) Client VM (24.0-b56 mixed mode windows-x86 )
# Problematic frame:
# C  [kernel32.dll+0x12fd3]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# D:\my_workspace\MapDisposeApp\hs_err_pid2132.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#


How can I justify this behavior to my teammate who are not GIS profiles ?
0 Kudos
ColinAnderson1
Esri Contributor
Unfortunately there was a change in the underlying native code that causes a crash if the map has not been disposed before shut down of the application and the issue was not discovered until too near the release to try and resolve it. Although this issue will hopefully be resolved in the next release you should always call dispose.
0 Kudos