View Issue Details

IDProjectCategoryView StatusLast Update
0000462Pgpool-IIBugpublic2019-02-07 15:49
Reporterjpedersen Assigned Tot-ishii  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionopen 
Product Version3.7.7 
Target Version3.7.8 
Summary0000462: ERROR: invalid memory alloc request size 1073742608
DescriptionHi,

When selecting more than 1 Gb of data $SUBJECT happens.

The Java application will show the issue, and has the following output:

5432 true: Success
5432 false: Success
9999 true: Failure
9999 false: Success

So, accessing PostgreSQL in both cases works.
Steps To ReproduceUse the Java application after its hard coded parameters have been changed.
TagsNo tags attached.

Activities

jpedersen

2019-01-31 23:18

reporter  

Test.java (2,393 bytes)   
Test.java (2,393 bytes)   

jpedersen

2019-02-01 03:17

reporter   ~0002358

In order to get TRACE from the JDBC driver the following is added to the URL: ?loggerLevel=TRACE&loggerFile=pgjdbc.log

jpedersen

2019-02-01 03:39

reporter   ~0002359

PostgreSQL: As compared to AutoCommit(true) the AutoCommit(false) case issues

FINEST: <=BE PortalSuspended
FINEST: <=BE ReadyForQuery(T)
FINEST: FE=> Execute(portal=C_1,limit=100)
FINEST: FE=> Sync

per 100 rows. See postgresql-diff.log.gz for the diffs between the interaction.
postgresql-diff.log.gz (1,055,909 bytes)

jpedersen

2019-02-01 04:14

reporter   ~0002360

I'm seeing the same interaction from Test.java's PoV for the query

PostgreSQL:
FINEST: simple execute, handler=org.postgresql.jdbc.PgStatement$StatementResultHandler@30946e09, maxRows=0, fetchSize=100, flags=17
FINEST: FE=> Parse(stmt=null,query="SELECT * FROM mytable",oids={})
FINEST: FE=> Bind(stmt=null,portal=null)
FINEST: FE=> Describe(portal=null)
FINEST: FE=> Execute(portal=null,limit=0)
FINEST: FE=> Sync
FINEST: <=BE ParseComplete [null]
FINEST: <=BE BindComplete [unnamed]
FINEST: <=BE RowDescription(3)
FINEST: Field(id_column,TEXT,65535,T)
FINEST: Field(data_column,BYTEA,65535,T)
FINEST: Field(timestamp_column,INT8,8,T)
FINEST: <=BE DataRow(len=574)
...

pgpool:
FINEST: simple execute, handler=org.postgresql.jdbc.PgStatement$StatementResultHandler@30946e09, maxRows=0, fetchSize=100, flags=17
FINEST: FE=> Parse(stmt=null,query="SELECT * FROM mytable",oids={})
FINEST: FE=> Bind(stmt=null,portal=null)
FINEST: FE=> Describe(portal=null)
FINEST: FE=> Execute(portal=null,limit=0)
FINEST: FE=> Sync
FINEST: <=BE ErrorMessage(ERROR: invalid memory alloc request size 1073742608

I can provide additional logs, if needed.

t-ishii

2019-02-05 15:52

developer   ~0002366

Can you share the table dump so that I could load the data before running your test program?

t-ishii

2019-02-05 21:16

developer   ~0002367

I have created a patch for this. Can you please try it out?
fixbug462.diff (6,411 bytes)   
fixbug462.diff (6,411 bytes)   

jpedersen

2019-02-05 21:43

reporter   ~0002368

I have updated the test client to use a pgbench based setup
Test-2.java (2,411 bytes)   
Test-2.java (2,411 bytes)   

jpedersen

2019-02-05 21:45

reporter   ~0002369

Verified V3_7_STABLE (576d1b0877e5405) after removing

src/include/context/pool_session_context.h
+>>>>>>> 51e3562f... Reduce memory usage when large data set is returned from backend.

Test 9999 true: Success
Test 9999 false: Success

t-ishii

2019-02-06 07:38

developer   ~0002371

Oops. Sorry for the mistake. I have pushed a fix.

BTW for the record, here is the commit URL to explain the reasoning of the fix:
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=8640abfc41ff06b1e6d31315239292f4d3d4191d

jpedersen

2019-02-06 21:20

reporter   ~0002374

Did you push ? I don't see it on the branch yet.

You probably meant: https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=51e3562f95b5d61f985142da5b5095d44d35ef29

t-ishii

2019-02-06 21:39

developer   ~0002377

> Did you push ? I don't see it on the branch yet.
Sorry, pushed now. Thanks for reminding me.

> You probably meant: https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=51e3562f95b5d61f985142da5b5095d44d35ef29
Again, thanks for pointing it out. Yes, this one.

jpedersen

2019-02-06 21:41

reporter   ~0002378

Thanks, you can resolve the issue :)

t-ishii

2019-02-07 15:49

developer   ~0002380

Got it. Thanks!

Issue History

Date Modified Username Field Change
2019-01-31 23:18 jpedersen New Issue
2019-01-31 23:18 jpedersen File Added: Test.java
2019-02-01 03:17 jpedersen Note Added: 0002358
2019-02-01 03:39 jpedersen File Added: postgresql-diff.log.gz
2019-02-01 03:39 jpedersen Note Added: 0002359
2019-02-01 04:14 jpedersen Note Added: 0002360
2019-02-01 11:03 administrator Assigned To => t-ishii
2019-02-01 11:03 administrator Status new => assigned
2019-02-05 15:52 t-ishii Note Added: 0002366
2019-02-05 15:52 t-ishii Status assigned => feedback
2019-02-05 21:16 t-ishii File Added: fixbug462.diff
2019-02-05 21:16 t-ishii Note Added: 0002367
2019-02-05 21:43 jpedersen File Added: Test-2.java
2019-02-05 21:43 jpedersen Note Added: 0002368
2019-02-05 21:43 jpedersen Status feedback => assigned
2019-02-05 21:45 jpedersen Note Added: 0002369
2019-02-06 07:38 t-ishii Note Added: 0002371
2019-02-06 21:20 jpedersen Note Added: 0002374
2019-02-06 21:39 t-ishii Note Added: 0002377
2019-02-06 21:41 jpedersen Note Added: 0002378
2019-02-07 15:49 t-ishii Note Added: 0002380
2019-02-07 15:49 t-ishii Status assigned => resolved
2019-02-07 15:49 t-ishii Target Version => 3.7.8