在 HP Tandem(不间断)中获取 Java 流时出现问题

发布于 2024-08-11 09:29:49 字数 3201 浏览 6 评论 0原文

我们正在 Tandem NonStop 系统(从 G 系列到 H 系列)之间移植一个简单​​的 Java 应用程序。 Java版本是1.5.0_02。

当执行基本 I/O 任务(例如从客户端套接字获取输出流或打开客户端套接字)时,我们会收到类似

java.io.IOException: Value out of range

java.net.SocketException: Value 的 异常超出范围

(“值超出范围”是 Tandem 的本地行话,我想几乎可以指代所有内容)。

有人遇到类似问题吗?例如,在扰乱 JNI 时发生 I/O 损坏?

我猜是系统出了问题,但可能出在哪里呢?

谢谢。

编辑:

添加片段

按照请求的示例片段 (a)

Properties envVars = new Properties();
Process p = r.exec("/bin/env");
envVars.load(p.getInputStream());

- 使用 Runtime.exec () (改编)堆栈跟踪 (a):

java.io.IOException: Value out of range (errno:4034)
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:194)
    at java.lang.UNIXProcess$DeferredCloseInputStream.read(UNIXProcess.java:221)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:254)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
    at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
    at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
    at java.io.InputStreamReader.read(InputStreamReader.java:167)
    at java.io.BufferedReader.fill(BufferedReader.java:136)
    at java.io.BufferedReader.readLine(BufferedReader.java:299)
    at java.io.BufferedReader.readLine(BufferedReader.java:362)
    at util.Environment.getVariables(Environment.java:39)

最后一行失败,输出被重定向到控制台(!)。

示例片段 (b) - 使用 HttpURLConnection

public WorkerThread (HttpURLConnection conn, String requestData, Logger logger)
{
    this.conn = conn;
    ...
}


public void run ()
{
    OutputStream out = conn.getOutputStream ();
}

堆栈跟踪 (b):

java.net.SocketException: Value out of range (errno:4034)
  at java.net.PlainSocketImpl.socketConnect(Native Method)
  at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
  at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
  at java.net.Socket.connect(Socket.java:507)
  at sun.net.NetworkClient.doConnect(NetworkClient.java:155)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:365)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:477)
  at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:280)
  at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:337)
  at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:176)
  at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:736)
  at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:162)
  at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:828)
  at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)

可以避免情况 (a),因为它是针对先前 JRE 版本 (!) 的其他问题的解决方法,但与套接字的行为相同实在是太恶心了。

We are porting a simple Java application between Tandem NonStop systems, from G-Series to H-Series. Java version is 1.5.0_02.

When performing basic I/O tasks like getting output stream from or opening a client socket, we receive exceptions like

java.io.IOException: Value out of range

or

java.net.SocketException: Value out of range

("value out of range" is Tandem native jargon for, well, quite everything I suppose).

Has anybody got similar issues? i.e. I/O corruption while for example messing with JNI?

I suppose there is something wrong with the system, but where might it be?

Thank you.

EDIT:

adding snippets as requested

sample snippet (a) - using Runtime.exec () (adapted)

Properties envVars = new Properties();
Process p = r.exec("/bin/env");
envVars.load(p.getInputStream());

Stack trace (a):

java.io.IOException: Value out of range (errno:4034)
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:194)
    at java.lang.UNIXProcess$DeferredCloseInputStream.read(UNIXProcess.java:221)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:254)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
    at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
    at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
    at java.io.InputStreamReader.read(InputStreamReader.java:167)
    at java.io.BufferedReader.fill(BufferedReader.java:136)
    at java.io.BufferedReader.readLine(BufferedReader.java:299)
    at java.io.BufferedReader.readLine(BufferedReader.java:362)
    at util.Environment.getVariables(Environment.java:39)

Last line fails, and output gets redirected to console (!).

sample snippet (b) - using HttpURLConnection:

public WorkerThread (HttpURLConnection conn, String requestData, Logger logger)
{
    this.conn = conn;
    ...
}


public void run ()
{
    OutputStream out = conn.getOutputStream ();
}

Stack trace (b):

java.net.SocketException: Value out of range (errno:4034)
  at java.net.PlainSocketImpl.socketConnect(Native Method)
  at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
  at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
  at java.net.Socket.connect(Socket.java:507)
  at sun.net.NetworkClient.doConnect(NetworkClient.java:155)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:365)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:477)
  at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:280)
  at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:337)
  at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:176)
  at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:736)
  at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:162)
  at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:828)
  at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)

Case (a) can be avoided because it was a workaround for other issues with previous JRE version (!), but same behaviour with sockets is really nasty.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风尘浪孓 2024-08-18 09:29:49

错误代码 4034 似乎表明特定服务器未在您的 NonStop 集群中运行。您确定您的系统设置正确吗?

Error code 4034 seem to indicate that a specific server is not running in your NonStop cluster. Are you sure that your system is setup properly?

殤城〤 2024-08-18 09:29:49

更新:该问题是由虚假的 .so 库引起的。

Update: The problem was caused by a spurious .so library.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文