Re: [sqlite] out of memory with sqlite3 shell

2009-02-11 Thread Roberto Lumbreras
I'm using the default allocator, and it is a uclinux system without dynamic
libraries, everything must be staticaly linked, so ltrace can't  help
(anyway, I think there is no ltrace available for this machine).

I'll try to use gdbserver to debug it, but I really don't understand why
sqlite3 is doing different things (working/not working) depending on which
filesystem the database file is located.

Salud,
Roberto Lumbreras


On Tue, Feb 10, 2009 at 9:42 PM, Roger Binns <rog...@rogerbinns.com> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Roberto Lumbreras wrote:
> > With strace the problem is clear: sqlite3 calls "old_mmap" with length=0.
> > I'm running version 2.6.25-uc0 of uCLinux, so mmap returns EINVAL because
> > length==0, then sqlite3 says "out of memory".
>
> The default SQLite 3 code never calls mmap.  Go ahead and grep the code
> to see!  Are you using a custom allocator?  If not then your malloc
> library is the problem.
>
> The ltrace command can help find the library routines responsible.
>
> Roger
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkmR5psACgkQmOOfHg372QT0DACgyI1/4fN5H2jFBPELIEiRRy1c
> 3HcAoMIDA7tNIW4K9SO4BVeIctQI3zjw
> =ssx5
> -END PGP SIGNATURE-
>
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] out of memory with sqlite3 shell

2009-02-10 Thread Roberto Lumbreras
Hi all,

I've an out of memory error with the sqlite3 (3.6.10) shell and a very small
database, in an uclinux embedded system (m68k arch).

With strace the problem is clear: sqlite3 calls "old_mmap" with length=0.
I'm running version 2.6.25-uc0 of uCLinux, so mmap returns EINVAL because
length==0, then sqlite3 says "out of memory".

The funny part is that I'm unable to get the error if the database file is
in a NFS mounted filesystem, but I always get
the error with the file in a local jffs2 filesystem.

What can I do to solve this problem?

I send you attached both strace logs.

Regards,
Roberto Lumbreras
117   execve("/nfs/sqlite3", ["/nfs/sqlite3", "/flash/config.db"], [/* 8 vars 
*/]) = 0
117   ioctl(0, SNDCTL_TMR_TIMEBASE, {B9600 opost isig icanon echo ...}) = 0
117   ioctl(1, SNDCTL_TMR_TIMEBASE, {B9600 opost isig icanon echo ...}) = 0
117   ioctl(0, SNDCTL_TMR_TIMEBASE, {B9600 opost isig icanon echo ...}) = 0
117   rt_sigaction(SIGINT, {b833a6, [INT], SA_RESTART}, {SIG_DFL}, 8) = 0
117   access("/flash/config.db", F_OK) = 0
117   old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 
0) = fc7000
117   open("/flash/config.db", O_RDWR|O_CREAT|O_LARGEFILE, 0644) = 3
117   fcntl(3, F_GETFD) = 0
117   fcntl(3, F_SETFD, FD_CLOEXEC) = 0
117   fstat(3, {st_mode=S_IFREG|0644, st_size=46080, ...}) = 0
117   lseek(3, 0, SEEK_SET) = 0
117   read(3, "SQLite format 3\0\4\0\1\1\0@  \0\0\0\3\0\0\0\0"..., 100) = 100
117   old_mmap(NULL, 53248, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 
0) = 3d
117   old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 
0) = 524000
117   getuid32()= 0
117   open("/etc/passwd", O_RDONLY) = 4
117   ioctl(4, SNDCTL_TMR_TIMEBASE, 42e810) = -1 ENOTTY (Not a typewriter)
117   old_mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 
0) = 4ee000
117   read(4, "root:*:0:0:Administr"..., 4096) = 71
117   close(4)  = 0
117   open("//.sqliterc", O_RDONLY) = -1 ENOENT (No such file or directory)
117   write(1, "SQLite version 3.6.10\nEnter \".he"..., 96) = 96
117   getuid32()= 0
117   open("/etc/passwd", O_RDONLY) = 4
117   ioctl(4, SNDCTL_TMR_TIMEBASE, 42e808) = -1 ENOTTY (Not a typewriter)
117   read(4, "root:*:0:0:Administr"..., 4096) = 71
117   close(4)  = 0
117   write(1, "sqlite> ", 8)   = 8
117   read(0, "select * from actors;\n", 4096) = 22
117   fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741824, 
len=1}) = 0
117   fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741826, 
len=510}) = 0
117   fcntl(3, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=1073741824, 
len=1}) = 0
117   access("/flash/config.db-journal", F_OK) = -1 ENOENT (No such file or 
directory)
117   fstat(3, {st_mode=S_IFREG|0644, st_size=46080, ...}) = 0
117   lseek(3, 0, SEEK_SET) = 0
117   read(3, "SQLite format 3\0\4\0\1\1\0@  \0\0\0\3\0\0\0\0"..., 1024) = 1024
117   lseek(3, 7168, SEEK_SET)  = 7168
117   read(3, "\r\0\0\0\5\0\0\0\1t\001Æ\2\3Z\0\0\0\0\0\0\0\0\0\0\0"..., 
1024) = 1024
117   old_mmap(NULL, 0, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 0) = 
-1 EINVAL (Invalid argument)
117   fcntl(3, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
117   write(1, "SQL error: out of memory\n", 25) = 25
117   write(1, "sqlite> ", 8)   = 8
117   read(0, "", 4096) = 0
117   close(3)  = 0
117   --- SIGILL (Illegal instruction) ---
117   +++ killed by SIGILL +++
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users