I build a CouchDB database with 2 millions documents containing 8 attributes (2 to 10 chars long) and a "channel" attribute with 2 strings.
Tried to replicate it to sync_gateway, after a hour (CouchBase reports already 2.587.000 records in data bucket) the go program has crashed with the following message
...
2013/01/31 22:20:13 Assigning doc "c5e35237e98fc32e21b8be5142097c30" to channels []
2013/01/31 22:20:13 Assigning doc "c5e35237e98fc32e21b8be51420988ab" to channels []
2013/01/31 22:20:13 --> 201
2013/01/31 22:20:40 HEAD /sync_gateway/
2013/01/31 22:20:42 GET /sync_gateway/
2013/01/31 22:20:42 GET /sync_gateway/_local/eff358b2433202e86fd73599c24b3d84
2013/01/31 22:20:42 --> 404 missing
2013/01/31 22:20:42 GET /sync_gateway/_local/784b528714c810ff80f22b6a202ae4f5
2013/01/31 22:20:42 --> 404 missing
2013/01/31 22:20:42 GET /sync_gateway/_changes?feed=normal&style=all_docs&since=0&heartbeat=10000
2013/01/31 22:20:47 GET /sync_gateway/
...
2013/01/31 22:23:39 GET /sync_gateway/
runtime: memory allocated by OS (0xb326a000) not in usable range [0x18a00000,0x98a00000)
throw: out of memory
goroutine 516 [running]:
reflect.unsafe_NewArray(0x18a7b000, 0x826fff4, 0x8d, 0x81eeb58, 0x176, ...)
/usr/local/go/src/pkg/runtime/iface.c:702 +0x80
reflect.MakeSlice(0x18a7b000, 0x81eeb58, 0x5e, 0x8d, 0x81eeb58, ...)
/usr/local/go/src/pkg/reflect/value.go:1650 +0x14a
encoding/json.(*decodeState).array(0x58b430e4, 0x81eeb58, 0x62ac6c84)
/usr/local/go/src/pkg/encoding/json/decode.go:364 +0x471
encoding/json.(*decodeState).value(0x58b430e4, 0x81eeb58, 0x62ac6c84)
/usr/local/go/src/pkg/encoding/json/decode.go:246 +0x1ba
encoding/json.(*decodeState).object(0x58b430e4, 0x826b5b0, 0x62ac6c80)
/usr/local/go/src/pkg/encoding/json/decode.go:555 +0x946
encoding/json.(*decodeState).value(0x58b430e4, 0x81ec4e8, 0x62ac6c80)
/usr/local/go/src/pkg/encoding/json/decode.go:249 +0x19f
encoding/json.(*decodeState).unmarshal(0x58b430e4, 0x81ec4e0, 0x62ac6c80, 0x0, 0x0, ...)
/usr/local/go/src/pkg/encoding/json/decode.go:136 +0x121
encoding/json.(*Decoder).Decode(0x58b430d0, 0x81ec4e0, 0x62ac6c80, 0x18aa4820, 0x74a37500, ...)
/usr/local/go/src/pkg/encoding/json/stream.go:48 +0xff
github.com/couchbaselabs/go-couchbase.(*Bucket).ViewCustom(0x18a6e3c0, 0x82a306c, 0xc, 0x8298e6c, 0x8, ...)
/home/teo/eclipse/workspace/bd2012/src/github.com/couchbaselabs/go-couchbase/views.go:105 +0x403
github.com/couchbaselabs/sync_gateway/db._func_001(0x1e0cd680, 0x1e0cd678, 0x1e0cd650, 0x1e0cd658, 0x1e0cd668, ...)
/home/teo/eclipse/workspace/bd2012/src/github.com/couchbaselabs/sync_gateway/db/changes.go:97 +0x244
created by github.com/couchbaselabs/sync_gateway/db.(*Database).ChangesFeed
/home/teo/eclipse/workspace/bd2012/src/github.com/couchbaselabs/sync_gateway/db/changes.go:163 +0x3d2
Running again the go program and trying to resume replication fails with the same message.
2013/02/01 00:12:17 GET /sync_gateway/
2013/02/01 00:12:19 GET /sync_gateway/_changes?feed=normal&style=all_docs&since=0&heartbeat=10000
2013/02/01 00:12:22 GET /sync_gateway/
2013/02/01 00:12:28 GET /sync_gateway/
2013/02/01 00:12:33 GET /sync_gateway/
runtime: memory allocated by OS (0xb3216000) not in usable range [0x18a00000,0x98a00000)
throw: out of memory
goroutine 12 [running]:
encoding/json.Unmarshal(0x98939d90, 0x66, 0x67, 0x81ec580, 0x9896f270, ...)
/usr/local/go/src/pkg/encoding/json/decode.go:55 +0x29
github.com/couchbaselabs/sync_gateway/db.RevTree.UnmarshalJSON(0x98937d20, 0x98939d90, 0x66, 0x67, 0x0, ...)
/home/teo/eclipse/workspace/bd2012/src/github.com/couchbaselabs/sync_gateway/db/revtree.go:77 +0x110
github.com/couchbaselabs/sync_gateway/db.(*RevTree).UnmarshalJSON(0x9896f1cc, 0x98939d90, 0x66, 0x67, 0x0, ...)
/home/teo/eclipse/workspace/bd2012/src/github.com/couchbaselabs/sync_gateway/db/attachment.go:0 +0x74
encoding/json.(*decodeState).object(0x98873f80, 0x8281368, 0x9896f1cc)
/usr/local/go/src/pkg/encoding/json/decode.go:415 +0xc7
encoding/json.(*decodeState).value(0x98873f80, 0x8281368, 0x9896f1cc)
/usr/local/go/src/pkg/encoding/json/decode.go:249 +0x19f
encoding/json.(*decodeState).object(0x98873f80, 0x82772e0, 0x9896f1b0)
/usr/local/go/src/pkg/encoding/json/decode.go:555 +0x946
encoding/json.(*decodeState).value(0x98873f80, 0x81ec560, 0x9896f1b0)
/usr/local/go/src/pkg/encoding/json/decode.go:249 +0x19f
encoding/json.(*decodeState).unmarshal(0x98873f80, 0x81ec558, 0x9896f1b0, 0x0, 0x0, ...)
/usr/local/go/src/pkg/encoding/json/decode.go:136 +0x121
encoding/json.Unmarshal(0x98939d20, 0xd7, 0xd7, 0x81ec558, 0x9896f1b0, ...)
/usr/local/go/src/pkg/encoding/json/decode.go:65 +0xcd
github.com/couchbaselabs/sync_gateway/db._func_001(0x18b20d78, 0x18b20d70, 0x18b20d48, 0x18b20d50, 0x18b20d60, ...)
/home/teo/eclipse/workspace/bd2012/src/github.com/couchbaselabs/sync_gateway/db/changes.go:126 +0x85b
created by github.com/couchbaselabs/sync_gateway/db.(*Database).ChangesFeed
/home/teo/eclipse/workspace/bd2012/src/github.com/couchbaselabs/sync_gateway/db/changes.go:163 +0x3d2
Teo