Skip to content

the error of insert #63

New issue

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

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

Already on GitHub? # to your account

Open
Qinka opened this issue Jul 31, 2016 · 14 comments
Open

the error of insert #63

Qinka opened this issue Jul 31, 2016 · 14 comments
Assignees

Comments

@Qinka
Copy link

Qinka commented Jul 31, 2016

first:

let a = repeat 'a'

.... connect with db
than:

Prelude Database.MongoDB> access  pipe master "local" $ insert "ac" ["txt"=: (take (1024*128) a)]
579dfb81421aa970b600002d
Prelude Database.MongoDB> access  pipe master "local" $ insert "ac" ["txt"=: (take (1024*129) a)]
-- finish until world is end.

I success to insert a string whose length is 1024_128 ,but when I inserted 1024_129 one I did not get the return (about 10mins), and then I passed Ctrl+C

The db is host on the localhost.

@Qinka
Copy link
Author

Qinka commented Jul 31, 2016

and if I kill the mongod when waiting for return, I will get

<interactive>: Data.Binary.Get.runGet at position 0: not enough bytes
CallStack (from HasCallStack):
  error, called at libraries/binary/src/Data/Binary/Get.hs:342:5 in binary-0.8.3.0:Data.Binary.Get
<interactive>: kevent: does not exist (No such file or directory)

And I think that, mongo and driver are both waiting to receive, or some one forgot to say the 'EOF' or 'OVER' of a message's end.

@VictorDenisov
Copy link
Member

Thanks. Looking into it.

@VictorDenisov VictorDenisov self-assigned this Aug 1, 2016
@VictorDenisov
Copy link
Member

@Qinka What version of MongoDB server are you using?

@VictorDenisov
Copy link
Member

I tried servers 2.4, 2.6, 3.0 and 3.2. The driver is able to get ids in all cases.

Try capturing traffic between your driver and mongodb server using the following command:

#!/bin/bash

sudo tcpdump -i lo -A -s 0 'tcp port 27017 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'

@Qinka
Copy link
Author

Qinka commented Aug 2, 2016

@@out.txt

And what I try to upload is a 1Mb file, and all of this file is letter 'a'.

I use mongo 3.2.8,

@VictorDenisov
Copy link
Member

Could you please try without SCRAM authentication? I see SCRAM authentication failure in the very beginning. I would like to be sure that it doesn't affect the issue. Just do traffic capture of this command: access pipe master "local" $ insert "ac" ["txt"=: (take (1024*129) a)]
Thanks in advance.

@Qinka
Copy link
Author

Qinka commented Aug 7, 2016

I just do that with:

access pipe master "local" $ insert "ac" [ "txt" =: (take (1024*250) a)] -- success & out1.txt
access pipe master "local" $ insert "ac" [ "txt" =: (take (1024*500) a)] -- failed & out2.txt

out1.txt
out2.txt

@VictorDenisov
Copy link
Member

What compiler version do you use BTW?

@VictorDenisov
Copy link
Member

Can I also see output of your: db.isMaster()
Run it in mongo command line.

@Qinka
Copy link
Author

Qinka commented Aug 7, 2016

GHC 8.0.1 (and 7.10.3 has the same problem )

> db.isMaster( )
{
    "ismaster" : true,
    "maxBsonObjectSize" : 16777216,
    "maxMessageSizeBytes" : 48000000,
    "maxWriteBatchSize" : 1000,
    "localTime" : ISODate("2016-08-07T11:59:34.067Z"),
    "maxWireVersion" : 4,
    "minWireVersion" : 0,
    "ok" : 1
}

@VictorDenisov
Copy link
Member

I tried 7.10.3 and it works for me. Could you please try converting the string to strict Text before saving?
Something like:

import qualified Data.Text as T
access pipe master "local" $ insert "ac" [ "txt" =: (T.pack $ take (1024*500) a)]

@VictorDenisov
Copy link
Member

Could you also please do one more traffic capture using the following command:

tcpdump -X -i lo -A -s 0 'tcp port 27017 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'

This command has -X option unlike the previous one.
Repeat the same scenario please:

access pipe master "local" $ insert "ac" [ "txt" =: (take (1024*250) a)] -- success & out1.txt
access pipe master "local" $ insert "ac" [ "txt" =: (take (1024*500) a)] -- failed & out2.txt

@Qinka
Copy link
Author

Qinka commented Aug 8, 2016

I found that the statements, such as access pipe master "local" $ insert "ac" [ "txt" =: (take (1024*500) a)], sometimes it did work, and it might not work at the others.

And I have tried with strict Text before saving, I till failed.

out.zip <- please rename to *.tar.xz

The out.1000.txt is the one failed, and 250~750 are the ones success.

(PS1: I'm not good at English, and I hope what I have typed are what I want to say)
(PS2: I am using Mac, OS X 10.11.6)

@VictorDenisov
Copy link
Member

Thank you @Qinka . Mac OS X shouldn't matter, but you never know. Let me see what I can get from the files. I'll let you know when I have something.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants