Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPDATE statements fails with "GDKerror: MT_mremap() failed" #3466

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed

UPDATE statements fails with "GDKerror: MT_mremap() failed" #3466

monetdb-team opened this issue Nov 30, 2020 · 0 comments

Comments

@monetdb-team
Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2014-04-07 11:41:35 +0200
From: Christian Braun <>
To: GDK devs <>
Version: 11.17.13 (Jan2014-SP1)
CC: @njnes, @swingbit, shuren1314

Last updated: 2015-05-07 12:38:07 +0200

Comment 19732

Date: 2014-04-07 11:41:35 +0200
From: Christian Braun <>

User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0
Build Identifier:

Part of a daily ETL routine i run a lot of statements like:
UPDATE x.t1 SET a = (SELECT a FROM x.t2 as t2 where t1.id = t2.id) where a IS NULL;

One UPDATE just failed with:
ERROR = !GDKerror:!ERROR: HEAPextend: failed to extend to 4521984 for 01/77/54/1775440.tail: MT_mremap() failed

On a later rerun the statement succeeded.

From the log file:

2014-04-06 05:29:23 MSG merovingian[9061]: proxying client (local) for database 'db' to mapi:monetdb:///var/monetdb/dbfarm/db/.mapi.sock?database=db
2014-04-06 05:29:23 MSG merovingian[9061]: target connection is on local UNIX domain socket, passing on filedescriptor instead of proxying
2014-04-06 05:29:27 ERR db[9073]: = gdk_posix.c:558: MT_mremap(bat/01/77/54/1775440.tail,7b1330081000,655360,4521984): p == MAP_FAILED
2014-04-06 05:29:29 MSG merovingian[9061]: proxying client (local) for database 'db' to mapi:monetdb:///var/monetdb/dbfarm/db/.mapi.sock?database=db
2014-04-06 05:29:29 MSG merovingian[9061]: target connection is on local UNIX domain socket, passing on filedescriptor instead of proxying
2014-04-06 05:29:29 MSG merovingian[9061]: proxying client (local) for database 'db' to mapi:monetdb:///var/monetdb/dbfarm/db/.mapi.sock?database=db
2014-04-06 05:29:29 MSG merovingian[9061]: target connection is on local UNIX domain socket, passing on filedescriptor instead of proxying
2014-04-06 05:29:29 MSG db[9073]: GDKmmap(3866624) fails, try to free up space [memory in use=1760358320,virtual memory in use=18446738982644412336]
2014-04-06 05:29:29 MSG db[9073]: GDKmmap(3866624) result [mem=1516209584,vm=18446733116116534704]
2014-04-06 05:29:29 MSG db[9073]: GDKmmap: recovery ok. Continuing..
2014-04-06 05:29:29 MSG merovingian[9061]: proxying client (local) for database 'db' to mapi:monetdb:///var/monetdb/dbfarm/db/.mapi.sock?database=db
2014-04-06 05:29:29 MSG merovingian[9061]: target connection is on local UNIX domain socket, passing on filedescriptor instead of proxying

Reproducible: Didn't try

Comment 19754

Date: 2014-04-16 08:59:36 +0200
From: @njnes

remap failing can be caused by running out of memory and/or out of disk space.
Is this somehow repeatable using a small(er) example?

Comment 19757

Date: 2014-04-16 13:19:48 +0200
From: Christian Braun <>

So far the error did not repeat. There was/is plenty of disk space available. The machine has 256GB memory. Both tables used in the update statement are not that big. About 15 million rows each. Columns are all bigint. Running out of memory seems unlikely to me.

Comment 20115

Date: 2014-09-01 18:07:45 +0200
From: @swingbit

I get the same problem on a CREATE statement, using the most recent code (v11.19.0 - Oct2014).

I exclude that memory / disk space isn't enough for this data/query combination.
NB: the same works fine on Feb2013.

Initial data dump is about 3MB.

During the query (a rather normal aggregate), two BATextend to the size of 510GB are attempted, which is not normal.

A 1-file test to reproduce the error is available here:
https://drive.google.com/file/d/0BwkuZ5tb4WEnT21wLVFWRndzcHM

Comment 20116

Date: 2014-09-01 18:08:55 +0200
From: @swingbit

For completeness, here the output of my test script:

$ mclient -p52500 -d x < bug3466.sql
DROP TABLE: no such table 'term_obj'
auto commit mode: off
operation successful
164280 affected row
auto commit mode: off
DROP TABLE: no such table 'obj_region'
auto commit mode: off
operation successful
29219 affected row
auto commit mode: on
GDK reported error.
HEAPextend: failed to extend to 548010065920 for 06/642.tail: MT_mremap() failed
HEAPextend: failed to extend to 548010065920 for 05/540.tail: MT_mremap() failed

Comment 20117

Date: 2014-09-01 18:47:57 +0200
From: @swingbit

And the relevant bit from the log:

2014-09-01 18:12:24 ERR x[32451]: = /opt/spinque/MonetDBServer/MonetDB.Spinque_Oct2014/src/gdk/gdk_posix.c:428: MT_mremap(./bat/06/604.tail,7f2d46390000,29818880,548010065920): GDKextendf() failed
2014-09-01 18:12:24 ERR x[32451]: = /opt/spinque/MonetDBServer/MonetDB.Spinque_Oct2014/src/gdk/gdk_posix.c:428: MT_mremap(./bat/05/501.tail,7f2d44720000,29818880,548010065920): GDKextendf() failed
2014-09-01 18:12:50 ERR x[32451]: !ERROR: bm_subcommit: commit failed
2014-09-01 18:12:50 ERR x[32451]: !ERROR: logger_exit: logger_commit failed
2014-09-01 18:12:50 ERR x[32451]: !FATAL: write-ahead logging failure, disk full?
2014-09-01 18:12:51 MSG x[32451]: !ERROR: GDKsave: error -1 on: name=01/105, ext=tail, mode=0
2014-09-01 18:12:51 MSG x[32451]: !OS: No space left on device

Comment 20118

Date: 2014-09-01 22:38:22 +0200
From: MonetDB Mercurial Repository <>

Changeset d4c521efe6b9 made by Sjoerd Mullender sjoerd@acm.org in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=d4c521efe6b9

Changeset description:

Better size extrapolation for result bat in mergejoin.
This hopefully fixes bug #3466.  It certainly makes that Roberto's
example runs on my system (where it didn't in the original version).

Comment 20119

Date: 2014-09-02 09:33:43 +0200
From: @swingbit

I confirm that I no longer get this problem (updated to changeset b3341f69aab6)

Comment 20120

Date: 2014-09-02 10:28:16 +0200
From: shuren <>

I get this error:
" GDKerror:!ERROR: HEAPextend: failed to extend to 4397727744 for 42\4226.theap: MT_mremap() failed"
when I use the batch import command(COPY INTO…).

I import 200 thousand/2 million/20 million rows every batch.It will give the above error when the data of this table exceeds 300 million rows(maybe 280 million rows).

My PC have 8G memory and enough disk space.

Data size of a record is less than 30B.

Comment 20121

Date: 2014-09-02 11:06:28 +0200
From: shuren <>

(In reply to comment 7)

I confirm that I no longer get this problem (updated to changeset
b3341f69aab6)

I am a freshman to use monetdb.
I get this error in my first apply of monetdb :
" GDKerror:!ERROR: HEAPextend: failed to extend to 4397727744 for 42\4226.theap: MT_mremap() failed"
when I use the batch import command(COPY INTO…).

I import 200 thousand/2 million/20 million rows every batch.It will give the above error when the data of this table exceeds 300 million rows(maybe 280 million rows).

My PC have 8G memory and enough disk space.

Data size of a record is less than 30B.

expect your reply.

Comment 20720

Date: 2015-03-18 16:38:30 +0100
From: @sjoerdmullender

I'm closing this report as fixed since it seems that my fix did indeed fix the original problem.

As to the problem described in comment 8 and 9, I would say that is a different problem and should get a different bug report.
However, first make sure what version of MonetDB you are running. In particular, are you running a 64 bit version? If not, then that's your problem right there: a 32 bit version cannot cope with large (more than a few GB) databases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant