You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (JIRA)" <ji...@apache.org> on 2013/08/10 14:41:49 UTC

[jira] [Comment Edited] (JENA-498) Multiple repeated use of HttpOp.execHttpPost leads to "No buffer space available (maximum connections reached?)"

    [ https://issues.apache.org/jira/browse/JENA-498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13735890#comment-13735890 ] 

Andy Seaborne edited comment on JENA-498 at 8/10/13 12:41 PM:
--------------------------------------------------------------

My test was to run a local Fuseki and ...

{noformat}
public class Jena498_HttpOp {
    public static void main( String[] args ) {
        String x = "PREFIX : <http://example/>  INSERT DATA { :s :p :o }" ; 
        UpdateRequest update = UpdateFactory.create(x) ;
        String SPARQL_UPDATE_END_POINT = "http://localhost:3030/ds/update" ;
        String qs = IRILib.encodeUriComponent("ASK{}") ;
        String queryURL = "http://localhost:3030/ds/sparql?query="+qs ;
        
        int i = 1 ;
        try {
            for ( ; ; i++) {
                if ( i % 1000 == 0 )
                    System.out.println("i = "+i) ;
                    HttpOp.execHttpPost("http://localhost:3030/ds/sparql", WebContent.contentTypeSPARQLQuery, "ASK{}") ;
                
//                UpdateProcessor u = UpdateExecutionFactory.createRemote(update, SPARQL_UPDATE_END_POINT) ;
//                u.execute() ;
                
//                if ( i % 100 == 0 ) {
//                    Lib.sleep(75) ;
//                }
            }
        } catch (Exception ex) {
            System.out.println("Iterations = " + i) ;
            ex.printStackTrace() ;
        }
    }
}


{noformat}

                
      was (Author: andy.seaborne):
    My test was to run a local Fuseki and ...
{noformat}
public class Jena498_HttpOp {
    public static void main( String[] args ) {
        String x = "PREFIX : <http://example/>  INSERT DATA { :s :p :o }" ; 
        UpdateRequest update = UpdateFactory.create(x) ;
        String SPARQL_UPDATE_END_POINT = "http://localhost:3030/ds/update" ;
        String qs = IRILib.encodeUriComponent("ASK{}") ;
        String queryURL = "http://localhost:3030/ds/sparql?query="+qs ;
        
        int i = 1 ;
        try {
            for ( ; ; i++) {
                if ( i % 1000 == 0 )
                    System.out.println("i = "+i) ;
                    HttpOp.execHttpPost("http://localhost:3030/ds/sparql", WebContent.contentTypeSPARQLQuery, "ASK{}") ;
            }
        } catch (Exception ex) {
            System.out.println("Iterations = " + i) ;
            ex.printStackTrace() ;
        }
    }
}

{noformat}

                  
> Multiple repeated use of HttpOp.execHttpPost leads to "No buffer space available (maximum connections reached?)"
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: JENA-498
>                 URL: https://issues.apache.org/jira/browse/JENA-498
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: RIOT
>    Affects Versions: Jena 2.10.1, Fuseki 0.2.7
>            Reporter: Andy Seaborne
>            Assignee: Andy Seaborne
>             Fix For: Jena 2.10.2
>
>
> From
> http://mail-archives.apache.org/mod_mbox/jena-users/201308.mbox/%3CCAE5DGJjODJJ-o5t4gJCGqc6mXPyLgDbsDgD%2BxM0eU6WZVacbbw%40mail.gmail.com%3E
> See 
> http://stackoverflow.com/questions/6068423/java-net-socketexception-no-buffer-space-available-maximum-connections-reached
> Things to check:
> * The SO link suggests having only one HttpClient.
> * Make sure the POST is closed (entity consumed)
> * Call HttpRequestBase.reset() 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira