Solaris上的*Error,但不是在Linux/Windows上。

时间:2022-09-06 15:39:46

I have a Java application that parses a large xml schema (.xsd) using Xerces that runs fine on Linux and Windows but gives a *Error on Solaris, with exactly the same inputs and configuration. I know that Xerces uses recursion to validate xml schemas but since it didn't give any problems on Windows and Linux I was pretty confident that it run everywhere.

我有一个Java应用程序,它使用Xerces解析一个大型xml模式(.xsd),在Linux和Windows上运行良好,但在Solaris上会出现*Error,输入和配置完全相同。我知道Xerces使用递归来验证xml模式,但由于它在Windows和Linux上没有任何问题,所以我对它在任何地方运行都很有信心。

Why does this happen? Is there a workaround?

这为什么会发生?有解决方案吗?

4 个解决方案

#1


5  

According to this page, the default stack size depends on the OS.

根据这个页面,默认的堆栈大小取决于操作系统。

Sparc: 512

Sparc:512

Solaris x86: 320 (was 256 prior in 5.0 and earlier) (update: According to this page, the size of the main thread stack comes from the ulimit. The main thread stack is artificially reduced by the vm to the -Xss value)

Solaris x86: 320(在5.0或更早版本之前是256)(更新:根据这个页面,主线程堆栈的大小来自于ulimit。主线程堆栈被vm人为地还原为-Xss值)

Sparc 64 bit: 1024

Sparc 64位:1024

Linux amd64: 1024 (was 0 in 5.0 and earlier) (update: The default size comes from ulimit, but I can be reduced with -Xss)

Linux amd64: 1024(在5.0或更高版本中为0)(更新:默认大小来自ulimit,但是可以使用-Xss来减少)

Windows: 256 (also here)

Windows:256(也)

You can change the default setting with the -Xss flag. For example:

您可以使用-Xss标志更改默认设置。例如:

java ... -Xss1024k ... <classname>

would set the default stack size to 1Mb.

将默认堆栈大小设置为1Mb。

#2


1  

Note that Hotspot VM parameter defaults may be different for different architectures. I would determine the defaults under Windows/Linux, and try setting those for Solaris.

注意,对于不同的体系结构,Hotspot VM参数默认值可能不同。我将确定Windows/Linux下的默认值,并尝试为Solaris设置这些值。

For example:

例如:

-XX:ThreadStackSize=512 - Thread Stack Size (in Kbytes). (0 means use default stack size) [Sparc: 512; Solaris x86: 320 (was 256 prior in 5.0 and earlier); Sparc 64 bit: 1024; Linux amd64: 1024 (was 0 in 5.0 and earlier); all others 0.]

- xx:ThreadStackSize=512 -线程堆栈大小(单位为Kbytes)。(0表示使用默认堆栈大小)[Sparc: 512;Solaris x86: 320(在5.0和更早的版本中是256之前);Sparc 64位:1024;Linux amd64: 1024(5.0或更高版本为0);所有其他0。)

(I'm not suggesting this particular parameter is the problem. Merely highlighting its differences under different OSes)

(我并不是说这个参数就是问题所在。仅仅是在不同的操作系统下突出其差异)

#3


1  

This is likely because the default maximum stack size differs between platforms.

这可能是因为平台之间默认的最大堆栈大小不同。

You can specify the stack size using the -Xss command line to the JVM, e.g.

您可以使用-Xss命令行到JVM指定堆栈大小。

java -Xss256k

java -Xss256k

For a 256k stack. This is allocated on a per-thread basis.

对于一个256 k堆栈。这是在每个线程的基础上分配的。

#4


-1  

Quote from javadoc:

从javadoc报价:

*Error:
Thrown when a stack overflow occurs because an application recurses too deeply.

*Error:由于应用程序递归太深而发生堆栈溢出时抛出。

How big a stack is, created for each method, is implementation dependent. That's the reason.

为每个方法创建的堆栈大小取决于实现。这就是原因。

#1


5  

According to this page, the default stack size depends on the OS.

根据这个页面,默认的堆栈大小取决于操作系统。

Sparc: 512

Sparc:512

Solaris x86: 320 (was 256 prior in 5.0 and earlier) (update: According to this page, the size of the main thread stack comes from the ulimit. The main thread stack is artificially reduced by the vm to the -Xss value)

Solaris x86: 320(在5.0或更早版本之前是256)(更新:根据这个页面,主线程堆栈的大小来自于ulimit。主线程堆栈被vm人为地还原为-Xss值)

Sparc 64 bit: 1024

Sparc 64位:1024

Linux amd64: 1024 (was 0 in 5.0 and earlier) (update: The default size comes from ulimit, but I can be reduced with -Xss)

Linux amd64: 1024(在5.0或更高版本中为0)(更新:默认大小来自ulimit,但是可以使用-Xss来减少)

Windows: 256 (also here)

Windows:256(也)

You can change the default setting with the -Xss flag. For example:

您可以使用-Xss标志更改默认设置。例如:

java ... -Xss1024k ... <classname>

would set the default stack size to 1Mb.

将默认堆栈大小设置为1Mb。

#2


1  

Note that Hotspot VM parameter defaults may be different for different architectures. I would determine the defaults under Windows/Linux, and try setting those for Solaris.

注意,对于不同的体系结构,Hotspot VM参数默认值可能不同。我将确定Windows/Linux下的默认值,并尝试为Solaris设置这些值。

For example:

例如:

-XX:ThreadStackSize=512 - Thread Stack Size (in Kbytes). (0 means use default stack size) [Sparc: 512; Solaris x86: 320 (was 256 prior in 5.0 and earlier); Sparc 64 bit: 1024; Linux amd64: 1024 (was 0 in 5.0 and earlier); all others 0.]

- xx:ThreadStackSize=512 -线程堆栈大小(单位为Kbytes)。(0表示使用默认堆栈大小)[Sparc: 512;Solaris x86: 320(在5.0和更早的版本中是256之前);Sparc 64位:1024;Linux amd64: 1024(5.0或更高版本为0);所有其他0。)

(I'm not suggesting this particular parameter is the problem. Merely highlighting its differences under different OSes)

(我并不是说这个参数就是问题所在。仅仅是在不同的操作系统下突出其差异)

#3


1  

This is likely because the default maximum stack size differs between platforms.

这可能是因为平台之间默认的最大堆栈大小不同。

You can specify the stack size using the -Xss command line to the JVM, e.g.

您可以使用-Xss命令行到JVM指定堆栈大小。

java -Xss256k

java -Xss256k

For a 256k stack. This is allocated on a per-thread basis.

对于一个256 k堆栈。这是在每个线程的基础上分配的。

#4


-1  

Quote from javadoc:

从javadoc报价:

*Error:
Thrown when a stack overflow occurs because an application recurses too deeply.

*Error:由于应用程序递归太深而发生堆栈溢出时抛出。

How big a stack is, created for each method, is implementation dependent. That's the reason.

为每个方法创建的堆栈大小取决于实现。这就是原因。