bulk insert failing

328 views
Skip to first unread message

monsters

unread,
May 1, 2013, 11:03:03 AM5/1/13
to rav...@googlegroups.com
Hi, 

issue #2 this morning.

I have a sample data creator, that I have been using locally, runs no problem.

using (var sess = doc.BulkInsert())

    for (var i = 0; i < 10; i++) 
    {  
       var col = new Collection 
       { 
           Name = string.Format(" Collection number: {0}", i) 
       }; 
       sess.Store(col); 
     } 
}


No i have ravend running on a vm in azure, and its failing with this

Internal Server Error
{
  "Url": "/bulkInsert?",
  "Error": "System.ObjectDisposedException: Safe handle has been closed\r\n   at 
<-snip->


Am i using bulk insert wrong?


My full method


        public void MakeData()

        {

            var doc = DocumentStoreHolder.DocumentStore;

            doc.Initialize();


      using (var sess = doc.BulkInsert())

            {

                for (var i = 0; i < 10; i++)

                {

                    var col = new Collection

                                  {

                                      Name = string.Format(" Collection number: {0}", i)

                                  };


                    sess.Store(col);

                }

            }

}



monsters

unread,
May 3, 2013, 10:18:57 AM5/3/13
to rav...@googlegroups.com
Hi,

Does anyone have a suggestion as to more info I could provide? Does the issue not make sense?

Bill.

Oren Eini (Ayende Rahien)

unread,
May 3, 2013, 2:21:55 PM5/3/13
to ravendb
This seems to be a bug in how we are caching credentials.
Will be fixed in the next build.


--
You received this message because you are subscribed to the Google Groups "ravendb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Bill

unread,
May 3, 2013, 2:32:42 PM5/3/13
to rav...@googlegroups.com
Great.

Is there a feed for builds? So i can know when they are released?

BIll.

-- 
Bill

You received this message because you are subscribed to a topic in the Google Groups "ravendb" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ravendb/SuVlI5g30wo/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to ravendb+u...@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
May 3, 2013, 2:39:40 PM5/3/13
to ravendb

monsters

unread,
Jun 3, 2013, 3:47:04 PM6/3/13
to rav...@googlegroups.com
just fired up build 2375 and it's doing the same thing.. the code this time:


 var docstore = new DocumentStore { ConnectionStringName = "RavenDB" };


            using (var bulkInsert = docstore.Initialize().BulkInsert())

            {

                for (int i = 0; i < 1000 * 1000; i++)

                {

                    bulkInsert.Store(new Game

                    {

                        HeartBeat= DateTime.Now.AddMinutes(i/10)

                    },"games/"+Guid.NewGuid().ToString());

                }

            }


The Exception:

http://pastebin.com/LD56saQD

monsters

unread,
Jun 3, 2013, 3:48:13 PM6/3/13
to rav...@googlegroups.com
just noticed my 1000 * 1000 in there! big number.

anyhow, i changed that to be JUST 1000, and it behaves exactly the same.

BIll.

Daniel Dar

unread,
Jun 4, 2013, 1:15:00 AM6/4/13
to rav...@googlegroups.com
can you create a failing test?


--

Daniel Dar

unread,
Jun 4, 2013, 6:00:59 AM6/4/13
to rav...@googlegroups.com
can you try using the latest 2.5 build?

Bill

unread,
Jun 4, 2013, 10:42:13 AM6/4/13
to rav...@googlegroups.com
Ok,

So this seems to be caused by not having anonymous authentication enabled.

I am using windows auth of course, with user/pass in the connection string and all is well. But if anonymous authentication is disabled, then the bulk insert fails.

Is bulk insert no using auth?

Bill.

-- 
Bill

You received this message because you are subscribed to a topic in the Google Groups "ravendb" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ravendb/SuVlI5g30wo/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to ravendb+u...@googlegroups.com.

Daniel Dar

unread,
Jun 4, 2013, 10:47:58 AM6/4/13
to rav...@googlegroups.com
which build are you using, as far as i know this was fixed already

Bill

unread,
Jun 4, 2013, 11:19:47 AM6/4/13
to rav...@googlegroups.com
I ran latest unstable and it worked, but not within iis..

do you think its fixed in latest stable?

Ok overwrote with latest stable (2375).. now in a world of hurt with windows permissions, egad.

getting 403 from bulk insert, fine for anything else. love windows auth, so simple..

-- 
Bill

Daniel Dar

unread,
Jun 4, 2013, 11:22:13 AM6/4/13
to rav...@googlegroups.com
i will check it out, hope to have a fix by tomorrow

Bill

unread,
Jun 4, 2013, 11:28:33 AM6/4/13
to rav...@googlegroups.com
I think this new issue is just general impenetrable permissions issues, not necessarily bulk insert related..

-- 
Bill

Bill

unread,
Jun 4, 2013, 11:45:51 AM6/4/13
to rav...@googlegroups.com
ok, a clean install of 2375, with no authentication 

<add key="Raven/AnonymousAccess" value="All"/>

i can store documents, but bulk insert is failing with a shiny new exception:


"System.ArgumentException: Token cannot be zero.\r\n   at System.Security.Principal.WindowsIdentity.CreateFromToken(IntPtr userToken)\r\n   at "

-- 
Bill

Daniel Dar

unread,
Jun 5, 2013, 1:43:33 AM6/5/13
to rav...@googlegroups.com
Bill, I want to go over this with you, will you be available for a skype session?

Oren Eini (Ayende Rahien)

unread,
Jun 6, 2013, 6:04:54 AM6/6/13
to ravendb
!($EUASJ

Because we send large amount of data to the server, we can't do the 401 dance for windows auth, and we can't rely on the 100 response to allow it.
We implement another auth mechanism just for that, but it require us to be able to read the server with anonymous auth enabled.



On Tue, Jun 4, 2013 at 5:42 PM, Bill <bi...@bigmojo.net> wrote:

Bill

unread,
Jun 6, 2013, 10:38:57 AM6/6/13
to rav...@googlegroups.com
huzzah. well that answers then.

I'm not a fan of windows auth, is there an alternate scheme i can use, while hosting under iis (which is very convenient)

-- 
Bill

Chris Marisic

unread,
Jun 6, 2013, 1:17:21 PM6/6/13
to rav...@googlegroups.com
ApiKeys or OAuth. Raven can also provide itself to be an OAuth server, or IIRC you can have it depend upon a stand alone OAuth server.

Bill

unread,
Jun 6, 2013, 3:28:24 PM6/6/13
to rav...@googlegroups.com
oh man apikeys look 1000 times better.

-- 
Bill

Kijana Woodard

unread,
Jun 6, 2013, 3:45:03 PM6/6/13
to rav...@googlegroups.com

+1

Justin A

unread,
Jun 7, 2013, 2:23:17 AM6/7/13
to rav...@googlegroups.com
remove windows auth for good. api keys or oauth.

Oren Eini (Ayende Rahien)

unread,
Jun 7, 2013, 3:15:54 AM6/7/13
to ravendb
There is API Keys.

Oren Eini (Ayende Rahien)

unread,
Jun 7, 2013, 3:16:15 AM6/7/13
to ravendb
You cannot really do that.
And API Keys ARE OAuth


On Fri, Jun 7, 2013 at 9:23 AM, Justin A <jus...@adler.com.au> wrote:
remove windows auth for good. api keys or oauth.

--

Mark Kabana

unread,
Jun 18, 2013, 2:14:46 AM6/18/13
to rav...@googlegroups.com
I'm running into this same issue using latest 2.5 b2607...running Raven on IIS and i do have Anonymous Authentication enabled but am still getting this error.

Any update on a fix for this?

Here's the stack trace of the error:

  "Error": "System.ArgumentException: Token cannot be zero.
   at System.Security.Principal.WindowsIdentity.CreateFromToken(IntPtr userToken)
   at System.Security.Principal.WindowsIdentity..ctor(IntPtr userToken, String authType, Int32 isAuthenticated)
   at System.Security.Principal.WindowsIdentity..ctor(IntPtr userToken)
   at Raven.Database.Server.Security.MixedModeRequestAuthorizer.OneTimeToken.get_User() in c:\\Builds\\RavenDB-Unstable-v2.5\\Raven.Database\\Server\\Security\\MixedModeRequestAuthorizer.cs:line 34
   at Raven.Database.Server.Security.MixedModeRequestAuthorizer.AuthorizeOSingleUseAuthToken(IHttpContext context, String token) in c:\\Builds\\RavenDB-Unstable-v2.5\\Raven.Database\\Server\\Security\\MixedModeRequestAuthorizer.cs:line 114
   at Raven.Database.Server.HttpServer.SetThreadLocalState(IHttpContext ctx) in c:\\Builds\\RavenDB-Unstable-v2.5\\Raven.Database\\Server\\HttpServer.cs:line 812
   at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx) in c:\\Builds\\RavenDB-Unstable-v2.5\\Raven.Database\\Server\\HttpServer.cs:line 746
   at Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx) in c:\\Builds\\RavenDB-Unstable-v2.5\\Raven.Database\\Server\\HttpServer.cs:line 635"

Oren Eini (Ayende Rahien)

unread,
Jun 18, 2013, 3:29:36 AM6/18/13
to ravendb
Can we check this on Skype?

Mark Kabana

unread,
Jun 18, 2013, 2:24:19 PM6/18/13
to rav...@googlegroups.com
Oren, yes that would be much appreciated if you can take a look at it on Skype, please add me and shoot me a message, my Skype username is: KabanaSoft

Thanks!

Oren Eini (Ayende Rahien)

unread,
Jun 18, 2013, 5:26:18 PM6/18/13
to ravendb
I've added you, I am ayenderahien on skype.


Simon Bartlett

unread,
Jul 16, 2013, 3:14:39 PM7/16/13
to rav...@googlegroups.com
Did you solve the "System.ArgumentException: Token cannot be zero" exception? We are getting the same exception on stable

bill keenan

unread,
Jul 16, 2013, 3:18:23 PM7/16/13
to rav...@googlegroups.com
for me, the site had to have anonymous authentication enabled, its used by bulk insert.

B.

--
You received this message because you are subscribed to a topic in the Google Groups "ravendb" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ravendb/SuVlI5g30wo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ravendb+u...@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
Jul 16, 2013, 3:59:57 PM7/16/13
to rav...@googlegroups.com
Yes

Simon Bartlett

unread,
Jul 16, 2013, 4:35:43 PM7/16/13
to rav...@googlegroups.com
What was the problem? How did you fix it?
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

Mark Kabana

unread,
Jul 16, 2013, 5:33:44 PM7/16/13
to rav...@googlegroups.com
I have confirmed that the bulk insert issue has been fixed using RavenDB Unstable v2.5 Build 2646

I no longer get the exception when trying to do the bulk insert.

Thanks for fixing this!

Oren Eini (Ayende Rahien)

unread,
Jul 16, 2013, 6:19:19 PM7/16/13
to ravendb
We don't try to do token cloning any longer, we rely on our own mechanism to do so
Reply all
Reply to author
Forward
0 new messages