Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8035399

Jackson ObjectMapper can cause a JVM SIGSEV if JDWP is on

    Details

    • Subcomponent:
      svc
    • Introduced In Build:
      b116
    • Introduced In Version:
      8
    • CPU:
      x86_64
    • OS:
      generic

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.8.0-ea"
        Java(TM) SE Runtime Environment (build 1.8.0-ea-b124)
        Java HotSpot(TM) 64-Bit Server VM (build 25.0-b66, mixed mode)

        FULL OS VERSION :
        Linux walec51-linux 3.8.0-35-generic #50-Ubuntu SMP Tue Dec 3 01:24:59 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux


        EXTRA RELEVANT SYSTEM CONFIGURATION :
        springVersion = 4.0.0.RELEASE
        jacksonVersion = 2.3.0
        junitVersion = 4.11

        A DESCRIPTION OF THE PROBLEM :
        If I run the given test case with just -Xdebug the test passes and I get the expected exception.

        But if I add: -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n,
        the JVM will crash with a SIGSEGV.

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # SIGSEGV (0xb) at pc=0x00007f4b96cec950, pid=7518, tid=139962649282304
        #
        # JRE version: Java(TM) SE Runtime Environment (8.0-b124) (build 1.8.0-ea-b124)
        # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.0-b66 mixed mode linux-amd64 compressed oops)
        # Problematic frame:
        # V [libjvm.so+0x82c950] Method::validate_bci_from_bcx(long) const+0x60
        #
        # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
        #
        # If you would like to submit a bug report, please visit:
        # http://bugreport.sun.com/bugreport/crash.jsp
        #


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.io.StringWriter;
        import java.util.HashMap;
        import java.util.Map;

        import org.junit.Test;
        import org.junit.runner.RunWith;
        import org.junit.runners.JUnit4;
        import org.springframework.validation.BeanPropertyBindingResult;

        import com.fasterxml.jackson.databind.JsonMappingException;
        import com.fasterxml.jackson.databind.ObjectMapper;
        import com.fasterxml.jackson.databind.SerializationFeature;

        @RunWith(JUnit4.class)
        public class ObjectMapperTests {

            /**
             * Expecting a StackOverflowError caused by infinite recursion
             */
            @Test(expected=JsonMappingException.class)
            public void sigsegvJvm() throws Exception {
                ObjectMapper om = new ObjectMapper();
                om.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
                BeanPropertyBindingResult br = new BeanPropertyBindingResult(
                        String.class, "someStringProperty");
                Map<String, Object> map = new HashMap<>();
                map.put("someAttr", br);
                StringWriter sw = new StringWriter();
                om.writer().writeValue(sw, map);
            }
        }
        ---------- END SOURCE ----------

          Attachments

          1. bugreport.txt
            1.29 MB
          2. repro.zip
            3.17 MB

            Issue Links

              Activity

                People

                • Assignee:
                  sspitsyn Serguei Spitsyn
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  8 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: