Socket read freezes on Linux despite timeout

We're using Linux 2.6 multiprocessor machines and Sun JDK 6.
Servers connect to each other over HTTP, setting socket timeout of 60 seconds.
Despite that sometimes sockets freeze forever in read() operation.
The code is like this:
URL url = new URL(endpoint);
URLConnection c = url.openConnection();
c.setConnectTimeout( 60000 );
c.setReadTimeout( 60000 );
InputStream in = c.getInputStream();
byte[] buffer = new byte[256 * 1024];
int readBytes = -1;
while ((readBytes = inputStream.read(buffer)) != -1) {
// use remote data
And the frozen stack trace is:
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:129)
java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
java.io.BufferedInputStream.read(BufferedInputStream.java:317)
sun.net.www.MeteredStream.read(MeteredStream.java:116)
java.io.FilterInputStream.read(FilterInputStream.java:116)
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2391)
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2386)
com.pmstation.shared.admin.core.MoveFile.pipeStream(MoveFile.java:189)
com.pmstation.shared.admin.core.MoveFile.transferFile(MoveFile.java:173)
Timeout not always working?
So to be sure HTTP read from remote server is never blocking I'm forced to do IO on a separate thread? Or there are better ideas?

Well then, it's important to note that a read timeout only specifies the amount of time to block while waiting for data. Once data has started to arrive, even one bit of data, the socket won't ever timeout because of a read timeout.
I think I have a solution, however. Don't use the built-in timeout function, write a polling method that times out after so many seconds without receiving data.
Try this ;-)
URL url = new URL(endpoint);
URLConnection c = url.openConnection();
c.setConnectTimeout( 60000 );
c.setReadTimeout( 60000 );
InputStream in = c.getInputStream();
byte[] buffer = new byte[256 * 1024];
int readBytes = -1;
/* Define our polling rates */
int max_wait  = 60000; // 60 seconds
int poll_rate = 2000;  // 2 seconds
int last_amount;
/* Poll for max_wait until we receive a full buffer */
for (int i = max_wait; i > 0; i -= poll_rate) {
    /* Get the number of available bytes */
    int available_bytes = inputStream.available();
    /* Reset the poll if we are actively receiving bytes */
    if (available_bytes > last_amount)
     i = max_wait;
    /* Update the last amount variable */
    last_amount = available_bytes;
    /* Don't read until we have a full buffer or are about to timeout */
    if ((available_bytes < buffer.length) && (i >= poll_rate))  {
     Thread.currentThread.sleep(poll_rate);
    else if (available_bytes > 0) {
        /* Must have enough bytes or be last poll before the timeout */
        if ((readBytes = inputStream.read(buffer,0,available_bytes)) != -1) {
            /* Reset the last_amount variable */
            last_amount = 0;
            // use remote data
}

Similar Messages

  • Socket read() call returning before timeout.

    I have a couple of applications which use the following basic socket reading approach:
    Socket socket = new Socket("192.168.0.1", 54321);
    socket.setSoTimeout (5000);
    InputStream stream = socket.getInputStream();
    byte[] data = new byte[232];
    boolean done = false;
    while (!done) {
        int res= stream.read(data);
        if (res < data.length) {
            System.err.println ("Error reading packet data - not enough data received: "+ res);
        // process and output the data
    try { stream.close(); } catch (Exception e) {}
    try { socket.close(); } catch (Exception e) {}The problem I am having is that sometimes read(byte[]) returns a before the full array's worth of data has been read, and before a timeout has occurred. I never get a SocketTimeoutException, but I do get my debugging output. I have recorded the network traffic with a packet sniffer (Wireshark), and what I am seeing is that in the instances where the read returns prematurely, it stops at the end of a TCP packet. The rest of the data is in another packet that arrives shortly afterwords (~1.5 ms or less).
    I know that with normal (file) input streams, read can return whenever it wants regardless of how many bytes were read, however I was under the impression that network streams are supposed to block until all the data arrives (or a timeout occurs, if set). Is this incorrect?

    djpeaco wrote:
    I know that with normal (file) input streams, read can return whenever it wants regardless of how many bytes were readThat's correct and that's exactly the reason you see the behavior you see.
    however I was under the impression that network streams are supposed to block until all the data arrives (or a timeout occurs, if set).Why? Why do you think that network streams behave differently in this regard?
    Why shouldn't it give you the data as soon as it's available, when every other stream works this way?
    Is this incorrect?Yes, you must assume that the streams of a socket follow the general InputStream/OutputStream contract and that includes possibly returning from read() before the full array is filled.

  • Linux socket read incomplete

    Hi,
    I have a problem with socket read on linux, when i do a socket read it does not read the complete string whereas the same program on windows read the string completely over a socket connections. Does anybody now why this is strange behaviour is happening on linux?
    BK

    You got lucky on Windows. The only guarantee from a blocking socket read is that you will read at least one byte or get an EOF,

  • Socket Read Timeout error in weblogic logs happening every 30 min

    One of my customer is getting Socket Read Time out error, when creating connection pool.
    java.sql.SQLException: Socket read timed out
         at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:74)
         at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:135)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:203)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:489)
         at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:439)
         at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:640)
         at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:205)
         at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:554)
         at weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(ConnectionEnvFactory.java:327)
         at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:227)
         at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1193)
         at weblogic.common.resourcepool.ResourcePoolImpl$ResourcePoolMaintanenceTask.timerExpired(ResourcePoolImpl.java:2451)
         at weblogic.timers.internal.TimerImpl.run(TimerImpl.java:273)
         at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused By: oracle.net.ns.NetException: Socket read timed out
         at oracle.net.ns.Packet.receive(Packet.java:333)
         at oracle.net.ns.DataPacket.receive(DataPacket.java:94)
         at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:176)
         at oracle.net.ns.NetInputStream.read(NetInputStream.java:121)
         at oracle.net.ns.NetInputStream.read(NetInputStream.java:96)
         at oracle.net.ns.Packet.extractData(Packet.java:443)
         at oracle.net.ns.AcceptPacket.<init>(AcceptPacket.java:108)
         at oracle.net.ns.NSProtocol.setNetStreams(NSProtocol.java:697)
         at oracle.net.ns.NSProtocol.connect(NSProtocol.java:386)
         at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1088)
         at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:305)
         at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:642)
         at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:205)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:554)
         at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:227)
         at weblogic.common.resourcepool.ResourcePoolImpl$ResourcePoolMaintanenceTask.timerExpired(ResourcePoolImpl.java:2451)
         at weblogic.timers.internal.TimerImpl.run(TimerImpl.java:273)
         at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Any suggestions?

    Could be a firewall rule terminating an idle connection?

  • Socket read error: connection reset by peer

    Hi.
    Has anybody experienced the error message �Socket read error: connection reset by peer�
    Please see below for detailed information.
    Appreciate your help
    Regards
    RT
    Enviroment specification
    Server: HP/UX 11.00 64-bit, Oracle RDBMS 8.1.6.0.0 64-bit
    2 firewalls between client and db.
    Client:
    Win 2000,
    SP3,
    Oracle Client 8.1.7.0.0 ,JDBC OCI (thin JDBC driver,class12.zip)
    JDK 1.3
    JRUN3.0
    The TCP protocol is being used in the communication
    Error messages
    Web Users receive:           Socket read error: connection reset by peer
    Trace files on the sever:      Read unexpected EOF ERROR on 18.
    Explanation: The error in the server sqlnet trace file, suggests that a client connection has terminated abnormally, i.e. client machine powered off, a cable removed or a network connection aborted without warning. No user has complained of such a problem and there is no client trace with an error.
    The problem
    The users of the java web application, experiencing an exception almost once or twice a day.
    The JRUN web-server reports broken connections to the db and client are receiving "connection reset by peer".
    At the moment when the errors occurs the users just have to wait a while(2-10 min) and then they can use the web application again.(no action is taken)
    This problem can not be reproduced. The problem happens only occasionally when the network is under heavy load and new DB connection is being created.
    The application
    The java web-application uses a customized connection pooling against the database. This pool is shared among all the users of the website. whenever a user process needs to fetch data from the database, a free connection from this pool is allocated. The application is testing if the connection is valid before making a transaction (select '1' from dual). When the error occurs a ORA-3113 end-of-file on communication channel is returned to the application.
    The path between the client and db involves at least two firewalls. The firewalls are opened for sql*net traffic. The network group can tell that enquiries from the app.server is not getting feedback from the db. They have not however, identified if the enquiries are reaching the db-srever, or if they are stopped earlier in the network.
    Around 1000 users, are using other applications which uses dedicated sqlnet connections against the db and they have not experienced any problems.
    Issues considered
    Connection pooling
    It is a customized connection pooling, developed by Lindorff developers.
    I have read through the source code for the connection pooling and it does the job as it should, and in case of bad connection, it tries to create a new connection.
    The log file shows that the call to the method DriverManager.getConnection() hangs until the server goes down, which is probably because of the fact that the method DriverManager.setLoginTimeout(), does not take effect and timeout value is Zero. ( According to oracle , Oracle JDBC does not support login timeouts and calling the static DriverManager.setLoginTimeout() method will have no effect).
    Firewall
    One thing to consider is when the firewall may decide to shut down the socket due to long inactivity of a connection. This will cause problems to JDBC Connection Pool because the pool is not aware of this disconnection at the TCP/IP level; until someone checks out the connection from the pool and tries to use it. The user will get a Socket read error: connection reset by peer.
    Jrun timeout paramter is less than the firewall�s timeout so the firewall will not close a connection before Jrun does.
    Number of processes the DB can handle
    Processes parameter is 1300, , they have not experienced the Oracle error msg �max # of processes reached�.
    Port redirection through a firewall:
    Since the firewall has a sql net proxy Port redirection through a firewall is not a problem. Problems with port redirection only appear at connect time, but in this situation the connections fail long after the connection is established.
    The network group
    The network people who investigaged the problem at Lindorff report that there are a significant amount of "dropped packages" between the database server and the jdbc client (web-application) 24 hrs. The reason for this is "unknown established TCP packet" which means that the firewall does not consider these packages to be part of an already established session. The network group believes this happen because one of the hosts send a RESET or FIN signal which the firewall have noticed but are not received by the other host.
    It seems like the firewall are dropping packages bacause of "Unknown
    established TCP packet" from both the JDBC client and the TNSLISTENER on the database server. The dropped packages are SQL*Net v2 traffic so clearly Oracle products are involved

    Presumably something is working.
    Thus the problem is not with your code. At least not the database part that you have control over.
    That error occurs when the other side closes the socket. Presumably you are catching lost connection exceptions and trying to restore it.

  • JDBC pooling Oracle driver Socket read timed out

    I run Java EE application on Glassfish server v3 together with Oracle 12 DB on the same machine under Windows Server 2012 64bit. I use latest ojdbc7 driver.
    Connection pool config:
      <jdbc-connection-pool validation-table-name="DUAL" steady-pool-size="20" statement-cache-size="100" associate-with-thread="true" statement-timeout-in-seconds="30" idle-timeout-in-seconds="60" max-wait-time-in-millis="2000" validate-atmost-once-period-in-seconds="20" datasource-classname="oracle.jdbc.pool.OracleDataSource" pool-resize-quantity="5" max-pool-size="60" res-type="javax.sql.DataSource" name="dbPool" is-connection-validation-required="true">
      <property name="driverClass" value="oracle.jdbc.OracleDriver"></property>
      <property name="user" value="xxx"></property>
      <property name="url" value="jdbc:oracle:thin:@(DESCRIPTION=(ENABLE=BROKEN)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl)))"></property>
      <property name="password" value="xxx"></property>
      <property name="portNumber" value="1521"></property>
      <property name="databaseName" value="orcl"></property>
      <property name="serverName" value="127.0.0.1"></property>
      <property name="oracle.jdbc.ReadTimeout" value="300000"></property>
      <property name="oracle.net.CONNECT_TIMEOUT" value="10000"></property>
      </jdbc-connection-pool>
    After 2 or 3 hours, when there is more than 1 user (3-5) using my application, it stops responding and I get this in glassfish logs
      javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource.allocator|_ThreadID=152;_ThreadName=Thread-2;|RAR5038:Unexpected exception while creating resource for pool dbPool. Exception : javax.resource.spi.ResourceAllocationException: Connection could not be allocated because: IO Error: Socket read timed out
      Local Exception Stack:
      Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
      Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: IO Error: Socket read timed out
    From the database side it looks like this
    Fatal NI connect error 12560, connecting to:
      (LOCAL=NO)
      VERSION INFORMATION:
      TNS for 64-bit Windows: Version 12.1.0.1.0 - Production
      Oracle Bequeath NT Protocol Adapter for 64-bit Windows: Version 12.1.0.1.0 - Production
      Windows NT TCP/IP NT Protocol Adapter for 64-bit Windows: Version 12.1.0.1.0 - Production
      Time: 13-JUN-2014 03:14:49
      Tracing not turned on.
      Tns error struct:
      ns main err code: 12560
      TNS-12560: TNS:protocol adapter error
      ns secondary err code: 0
      nt main err code: 0
      nt secondary err code: 0
      nt OS err code: 0
      opiodr aborting process unknown ospid (3404) as a result of ORA-609
    When I just reset db listener everything works ok for next 1-2 hours (depends on application load). So temporary solution is to run bat script from windows scheduler to reset the listener every 1h.
    I tried everything I could find - applied these parameters:
      - Sqlnet.ora:
      SQLNET.INBOUND_CONNECT_TIMEOUT=180
      SQLNET.EXPIRE_TIME=5
      - Listener.ora:
      INBOUND_CONNECT_TIMEOUT_LISTENER_IPC=120
    But still without success

    Is the problem here just that you need a connection pool that closes idle connections?  Some pools will close idle connections after a time out period.  And the pool lets you set that time out period.  If the pool you are using doesn't provide that then use a different pool.

  • WebLogic 11g data source connection pooling failed with IO error:socket read timed out.

    Hi all,
    We encountered IO Error: Socket read timed out( <Received exception while creating connection for pool "DS_1": IO Error: Socket read timed out> ) during the creation of data sources in WebLogic 11g. Manual data source testing seems to indicate intermittent connection and the server seems to take a long time to start up with multiple IO errors. We increased the timeout at the database side but it does not seems to help. The database is 11g (11.2.0.3). The database services and listener are up which does not indicate that the database instance is down.

    This particular error means your database is down and socket is timedout. Or the query takes so long that the reader timedout -- unlikely.
    Also, the general weblogic socket write errors, which you might see sometimes means that the client got disconnected before the server wrote results back. This is harmless

  • Java.sql.SQLException: Io exception: Socket read timed out

    Hello,
    I've a interface RFC - JDBC - RFC.
    When this interface is executing, i have the follow error in RuntimeWorkbench::
    'Unable to execute statement for table or stored procedure. 'TABLAERR' (Structure 'STATEMENT') due to java.sql.SQLException: Io exception: Socket read timed out'
    In SXMB_MONI do not see any message, only
    '  <SAP:Category>XIAdapterFramework</SAP:Category>
      <SAP:Code area="MESSAGE">GENERAL</SAP:Code>
      <SAP:P1 />
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText>com.sap.aii.af.ra.ms.api.DeliveryException</SAP:AdditionalText>
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack />
      <SAP:Retry>M</SAP:Retry> '
    this error don't occurs always, when and why i don't know..
    I searched for information about this error and nothing found
    why it is happens?
    thank very much

    HI,
    This is not a problem in ur mapping or configuration.
    This is a problem with JDBC connection. This is a common error, that generally comes when the DB server is receiving and processing numerous records. Connection time out or socket read time out.
    First try this:
    In ur JDBC adapter go to Advanced Tab Page and check Transaction Isolation Level as Serializable.
    If still problem persists then take help of basis guys and increase the timeout for the connection, same thing can be asked from DB team.

  • Unable to read field value from main table - unexpected socket read error

    Hi Friends,
    While executing the below code, I am able to get the value of the field 'id' but i am unable to get the value for the 'materialnumber' field. i am getting the below exception
    +com.sap.mdm.commands.CommandException: com.sap.mdm.internal.protocol.manual.ProtocolException: java.io.IOException: Unexpected socket read.  Result is -1.
         at com.sap.mdm.data.commands.AbstractRetrieveLimitedRecordsCommand.execute(AbstractRetrieveLimitedRecordsCommand.java:158)
         at com.sap.mdm.data.commands.RetrieveLimitedRecordsCommand.execute(RetrieveLimitedRecordsCommand.java:157)
         at updaterecords.main(updaterecords.java:126)
    Caused by: com.sap.mdm.internal.protocol.manual.ProtocolException: java.io.IOException: Unexpected socket read.  Result is -1.
         at com.sap.mdm.internal.protocol.manual.AbstractProtocolCommand.execute(AbstractProtocolCommand.java:100)
         at com.sap.mdm.data.commands.AbstractRetrieveLimitedRecordsCommand.execute(AbstractRetrieveLimitedRecordsCommand.java:146)
         ... 2 more
    Caused by: java.io.IOException: Unexpected socket read.  Result is -1.
         at com.sap.mdm.internal.net.DataSocket.receiveData(DataSocket.java:59)
         at com.sap.mdm.internal.net.ConnectionImpl.readInt(ConnectionImpl.java:417)
         at com.sap.mdm.internal.net.ConnectionImpl.nextMessage(ConnectionImpl.java:501)
         at com.sap.mdm.internal.net.ConnectionImpl.receiveMessage(ConnectionImpl.java:472)
         at com.sap.mdm.internal.net.ConnectionImpl.send(ConnectionImpl.java:209)
         at com.sap.mdm.internal.net.ReservedConnection.send(ReservedConnection.java:105)
         at com.sap.mdm.internal.protocol.manual.AbstractProtocolCommand.execute(AbstractProtocolCommand.java:97)
         ... 3 more+
    import com.sap.mdm.commands.AuthenticateUserSessionCommand;
    import com.sap.mdm.commands.CommandException;
    import com.sap.mdm.commands.CreateUserSessionCommand;
    import com.sap.mdm.commands.DestroySessionCommand;
    import com.sap.mdm.commands.GetRepositoryRegionListCommand;
    import com.sap.mdm.data.Record;
    import com.sap.mdm.data.RegionProperties;
    import com.sap.mdm.data.ResultDefinition;
    import com.sap.mdm.data.commands.RetrieveLimitedRecordsCommand;
    import com.sap.mdm.ids.TableId;
    import com.sap.mdm.net.ConnectionException;
    import com.sap.mdm.net.ConnectionPool;
    import com.sap.mdm.net.ConnectionPoolFactory;
    import com.sap.mdm.schema.FieldProperties;
    import com.sap.mdm.schema.RepositorySchema;
    import com.sap.mdm.schema.commands.GetFieldListCommand;
    import com.sap.mdm.schema.commands.GetRepositorySchemaCommand;
    import com.sap.mdm.search.Search;
    import com.sap.mdm.server.DBMSType;
    import com.sap.mdm.server.RepositoryIdentifier;
    public class updaterecords {
         public static void main(String[] args) {
              try {               
                    String serverName = "159.112.6.26";
                    ConnectionPool connections = null;
                    try {
                         connections = ConnectionPoolFactory.getInstance(serverName);
                    } catch (ConnectionException e) {
                         e.printStackTrace();
                         return;
                   // specify the repository to use
                   // alternatively, a repository identifier can be obtain from the GetMountedRepositoryListCommand
                   String repositoryName = "DEMO";
                   String dbmsName = "MDMD";
                   RepositoryIdentifier reposId = new RepositoryIdentifier(repositoryName, dbmsName, DBMSType.ORACLE);
                   // get list of available regions for the repository
                   GetRepositoryRegionListCommand regionListCommand = new GetRepositoryRegionListCommand(connections);
                   regionListCommand.setRepositoryIdentifier(reposId);
                   try {
                        regionListCommand.execute();
                   } catch (CommandException e) {
                        e.printStackTrace();
                        return;
                   RegionProperties[] regions = regionListCommand.getRegions();
                   // create a user session
                   CreateUserSessionCommand sessionCommand = new CreateUserSessionCommand(connections);
                   sessionCommand.setRepositoryIdentifier(reposId);
                   sessionCommand.setDataRegion(regions[0]); // use the first region
                   try {
                        sessionCommand.execute();
                   } catch (CommandException e) {
                        e.printStackTrace();
                        return;
                   String sessionId = sessionCommand.getUserSession();
                   // authenticate the user session
                   String userName = "meter1";
                   String userPassword = "meter1";
                   AuthenticateUserSessionCommand authCommand = new AuthenticateUserSessionCommand(connections);
                   authCommand.setSession(sessionId);
                   authCommand.setUserName(userName);
                   authCommand.setUserPassword(userPassword);
                   try {
                        authCommand.execute();
                   } catch (CommandException e) {
                        e.printStackTrace();
                        return;
                   GetRepositorySchemaCommand cmd=new GetRepositorySchemaCommand(connections);
                   cmd.setSession(sessionId);
                   try{
                        cmd.execute();               
                   }catch(CommandException e){
                        System.out.println(e.getLocalizedMessage());
                   RepositorySchema repsch=cmd.getRepositorySchema();
                   // the main table, hard-coded
                   TableId mainTableId = new TableId(1);     
                   // specify the result definition (what to retrieve); in this example, nothing
                   ResultDefinition rd = new ResultDefinition(mainTableId);
                   // select all records
                   Search search = new com.sap.mdm.search.Search(mainTableId);
                   //get fields
                   GetFieldListCommand getFieldListCommand = new GetFieldListCommand(connections);
                   getFieldListCommand.setSession(sessionCommand.getUserSession());
                   getFieldListCommand.setTableId(mainTableId);
                   try {
                        getFieldListCommand.execute();
                   } catch (CommandException e) {
                        System.out.println(e);
                   FieldProperties[] lookupFields = getFieldListCommand.getFields();
                   // add fields to records to retrieve
                   rd.addSelectField(repsch.getFieldId("Products","Id"));
                   rd.addSelectField(repsch.getFieldId("Products","MaterialNumber"));                              
                   // retrieve the records
                   RetrieveLimitedRecordsCommand limitingCommand = new RetrieveLimitedRecordsCommand(connections);
                   limitingCommand.setSession(sessionId);
                   limitingCommand.setResultDefinition(rd);
                   limitingCommand.setSearch(search);
                   //limitingCommand.setPageSize(2000);
                   try {
                        limitingCommand.execute();
                   } catch (CommandException e) {
                        e.printStackTrace();
                        return;
                   System.out.println("Record count is " + limitingCommand.getRecords().getCount()+"\n");
                   Record[] records=limitingCommand.getRecords().getRecords();
    System.out.println(records[0].getFieldValue(repsch.getFieldId("Products","Id"))+ " \n");
    System.out.println(records[0].getFieldValue(repsch.getFieldId("Products","MaterialNumber"))+ " \n");
                   // finally destroy the session
                   DestroySessionCommand destroySessionCommand = new DestroySessionCommand(connections);
                   destroySessionCommand.setSession(sessionId);
                   try {
                        destroySessionCommand.execute();
                   } catch (CommandException e) {
                        e.printStackTrace();
                        return;
              } catch (Exception e) {
                   System.out.println(e.getLocalizedMessage());
                   e.printStackTrace();
    Kindly let me know where i am going wrong. MaterialNumber field is a TEXT not a lookup table field.  Above fields are from the main table.
    Thanks,
    Raags

    Hi Friends,
    I got the solution. It was the error because of not having a the below statement.
    limitingCommand.setPageSize(1);
    As i havent used that statement, it was trying to get 1000 records, and i dont know exactly what makes this to get that error. Anyhow., As i want to use for updation, i cn live with one record.
    Thanks,
    Raags

  • Socket reading -writing

    hello friends i am new to this forum and looking forward for some help from you guys
    suppose i open a socket and made a connection to the remote server
    now i have one socket with me and another corrresponding socket with the server .i write a very long string containig
    new lines out.println("vey long string");
    and i close the socket or the function in which i am doing this job exits.
    would the remote server able to read from its socket or not that is does the closing of socket on one side closes the whole connection.

    if its a TCP socket if you close one side the connection is closed, so it will not be able to read from its socket.

  • IO Error: Socket read timed out / IOP_iopinstance1_datasource" closed

    Hi ,
    Can somebody suggest what could be the probable cause of following errors showing up in IOP log file?
    ####<Aug 16, 2011 10:49:11 PM PDT> <Info> <Common> <sc-csttest> <IOPServer_iopinstance1> <weblogic.work.j2ee.J2EEWorkManager$WorkWithListener@357ac2f7> <<anonymous>> <> <0000J7MI9kZFk3vLsYw0yX1EIpFA00002K> <1313560151943> <BEA-000628> <Created "1" resources for pool "IOP_iopinstance1_datasource", out of which "1" are available and "0" are unavailable.>
    ####<Aug 16, 2011 10:49:12 PM PDT> <Info> <JDBC> <sc-csttest> <IOPServer_iopinstance1> <weblogic.work.j2ee.J2EEWorkManager$WorkWithListener@357ac2f7> <<anonymous>> <> <0000J7MI9kZFk3vLsYw0yX1EIpFA00002K> <1313560152146> <BEA-001128> <Connection for pool "IOP_iopinstance1_datasource" closed.>
    java.sql.SQLRecoverableException: IO Error: Socket read timed out
    Thanks
    Lokesh

    This particular error means your database is down and socket is timedout. Or the query takes so long that the reader timedout -- unlikely.
    Also, the general weblogic socket write errors, which you might see sometimes means that the client got disconnected before the server wrote results back. This is harmless

  • Adobe Reader freeze while printing

    Hello, I have a proble with any PDF documents when I can print them in Adobe Reader. I have the latest version of Adobe Reader but the problem also happends in the previous version. I have Windows 7 Pro. The problem is that I open the PDF document and after I try to print it, Adobe Reader freeze and no print output comes. There is no problem to view the PDFs but it is impossible to print them.
    Thank you.

    Try if it works better after disabling Protected Mode [Edit | Preferences | Security (Enhanced)].

  • Acrobat Reader for 64bit Linux is needed

    64bit Linux is becoming more prevalent due to the 64bit machines being created now a days.  Why isn't the 64bit Adobe Acrobat Reader available for Linux?

    The 32 bit .deb file does not install on 64 bit ubuntu systems.  Let me know
    if there is a trick to getting the 32 bit .deb file to install on 64 bit
    systems.
    Why was the 64 bit Acrobat created for Windows 7?  The reasons would be the
    same for Linux.  The 64 bit Acrobat would allow working with very large pdf
    files.
    Kind regards,
    Ralph Navarro

  • GPIB read freezing when running vi without debug light ... (it works with the light)

    I have a gpib read that spits out two values at a offset. This is in a loop thats defined by the initial , final and step size parameters. My question is, why does the gpib read freezes (or doesn't exectue; whenever I turn the debug light on(after it's been run), it 'lights' up only till the gpib read and nothing further). I replaced the gpib read with visa read , it doesn't freeze anymore but it only records zeros (when I can clearly see my system outputting some values). Any help would be appreciated.
    *there was a similar topic about debug light and the reasoning was made to be a race condition. but I dont see how my situation is a race condition.
    Thanks,
    kb.
    Solved!
    Go to Solution.
    Attachments:
    racecond.PNG ‏37 KB

    kb003 wrote:
    Cleaning up...for me thats the cleaned up version. I'm still figuring out labview. 
    Stacked sequence made the perfect sense in a 1-2-3 logical reasoning. 
    <snip>
    I wrote my code from an ancient driver set. I figured why to mess with something that's already working. So, I built it all on gpib. 
    This brings up an ancient scrap I have with National Instruments.  Namely, they advertize LabVIEW as something so easy to use, you can dive right in.  Well the truth is, you can dive right in, but it's guaranteed you will be writing horrible code, and much more easily than with any other programming language.
    In reality, you really have to have training, formal (classes) or informal (books on LabVIEW), just like with any other programming language.  Because NI keeps promoting the LabVIEW Falsehood, you get managers that assign newbies to write complex code, and then you have issues like the one the poster has above.
    I'll get off my soapbox now and return you to your local programming, already in progress...
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • Why does reader freeze while opening some pdf files and others open instantaneously?

    I use pdf files created from CamScanner and shared from DropBox.  In DropBox, many times (over 50%) while opening the PDF the process freezes and the error message is Adobe Reader is not responding.  If you close the program, and re-open the file, it opens fine.  I have saved these files to my computer and the same issue occurs.  The files are 100-500kb, so I do not think size is the issue.  I have reinstalled Reader (11.1.10) and there is no improvement.

    This appears to have reduced the time to load a document.  Thanks Jimb      From: Anubha Goel <[email protected]>
    To: jimb70395944 <[email protected]>
    Sent: Friday, March 20, 2015 4:37 AM
    Subject: You have been mentioned by Anubha Goel in Re: why does reader freeze while opening some pdf files and others open instantaneously? in Adobe Community
    |
    You have been mentioned
    by Anubha Goel in Re: why does reader freeze while opening some pdf files and others open instantaneously? in Adobe Community - View Anubha Goel's reference to you  Hey jimb70395944, Please try disabling protected mode under 'Edit> Preferences> Security (Enhanced)' and uncheck 'Enable Enhanced Security' option.Then, try again and let me know.  Regards,Anubha
    Participate in the conversation by replying to this email
    To stop receiving these messages whenever you are mentioned, go to your preferences and disable notifications for direct social actions. |

Maybe you are looking for

  • Need Help with script: CS4 Flash Buttons

    I created a 3 button bar using Flash CS4. It will link to three different HTML pages in a website. This is one of the three scripts I have on the first frame of the main timeline, the code is for one of the buttons, the other two are really the same

  • Scroll Wheel no longer works. Please Help !

    About a month ago, my scroll wheel suddenly just stopped working. I now have very limited use of it. For example, I cannot scroll through my song list, because it takes about 5 minutes of constantly trying to scroll, for it to move down one song. The

  • Lightroom and Photoshop Implications for switching platforms from a PC to Mac

    I'm looking at purchasing a new computer and making the swing from PC to Mac. Currently, I'm running Photoshop CS5 and Lightroom 4 on my PC. If I switch to a Mac, what are the implications? Can my Lightroom catalogs on my PC be easily transferred?  W

  • My itunes 11 keeps freexing

    hi since i have upgraded to itunes version 11 it keeps freezing on me all the time,ive un installed and reinstalled 5 times now and its still the same? it was working fine untill i got the new version i run windows 7 at the moment PLEASE HELP ME aaaa

  • Different types of mapping techics

    hi expects,    please provide some mapping technics.