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

Issue download ReGrid file after upload #28

Closed
jakejscott opened this issue Feb 12, 2016 · 16 comments
Closed

Issue download ReGrid file after upload #28

jakejscott opened this issue Feb 12, 2016 · 16 comments

Comments

@jakejscott
Copy link

I'm on Windows 7 using VS2013 with 2.2.5-beta-2 RethinkDb.Driver.ReGrid nuget package. I'm also using the Windows version of the server RethinkDB 2.2.4-windows-alpha-4

I can upload the file ok using this code

Bucket bucket = new Bucket(connection, dbname, "file");
bucket.Purge();
bucket.Mount();

var uploadId = bucket.Upload("MyNameIsBob.jpg", File.ReadAllBytes("1.jpg"));
log.Information("UploadId {uploadId}", uploadId);

Which logs out the file Id

2016-02-13 11:44:53 [Information] UploadId d9620ba1-fe64-45bb-8cba-d2faa9d77f12

But when I try and download I get this error:

byte[] bytes = bucket.DownloadBytes(uploadId, new DownloadOptions());
log.Information("MyNameIsBob length {length}", bytes.Length);

This is the exception stack trace:

System.AggregateException: One or more errors occurred. ---> RethinkDb.Driver.ReGrid.ChunkException: ReGrid chunk 2 of file id d9620ba1-fe64-45bb-8cba-d2faa9d77f12 is missing.
   at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.GetNextBatchFromCursor(Boolean hasMore)
   at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.<GetNextBatchAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.<GetSegmentAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.<ReadAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at RethinkDb.Driver.ReGrid.Bucket.<DownloadToStreamHelperAsync>d__36.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at RethinkDb.Driver.ReGrid.Bucket.<DownloadBytesHelperAsync>d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at RethinkDb.Driver.ReGrid.Bucket.<DownloadBytesHelperAsync>d__33.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at RethinkDb.Driver.ReGrid.Bucket.<DownloadAsBytesAsync>d__26.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at RethinkDb.Driver.Utils.TaskHelper.WaitSync[T](Task`1 task)
   at RethinkDb.Driver.ReGrid.Bucket.DownloadBytes(Guid fileId, DownloadOptions options)
   at Sprightly.ConsoleSpike.Program.<>c__DisplayClass5.<<Main>b__4>d__7.MoveNext() in c:\Dev\Sprightly\src\Sprightly.ConsoleSpike\Program.cs:line 71
---> (Inner Exception #0) RethinkDb.Driver.ReGrid.ChunkException: ReGrid chunk 2 of file id d9620ba1-fe64-45bb-8cba-d2faa9d77f12 is missing.
   at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.GetNextBatchFromCursor(Boolean hasMore)
   at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.<GetNextBatchAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.<GetSegmentAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at RethinkDb.Driver.ReGrid.DownloadStreamForwardOnly.<ReadAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at RethinkDb.Driver.ReGrid.Bucket.<DownloadToStreamHelperAsync>d__36.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at RethinkDb.Driver.ReGrid.Bucket.<DownloadBytesHelperAsync>d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at RethinkDb.Driver.ReGrid.Bucket.<DownloadBytesHelperAsync>d__33.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at RethinkDb.Driver.ReGrid.Bucket.<DownloadAsBytesAsync>d__26.MoveNext()<---








@bchavez
Copy link
Owner

bchavez commented Feb 12, 2016

Hey there, alpha4 is a bit buggy, could you try giving alpha5 a try?

Link is here:
http://circus.atnnn.com/ipfs/QmQaZiJNyAkWshdD3xRBmLYjvgoDpzm8QNYAStpo6SifDo/rethinkdb-windows-alpha-5.zip

@jakejscott
Copy link
Author

Sure!

@jakejscott
Copy link
Author

Still getting the same error after updating to alpha5 unfortunately

@bchavez
Copy link
Owner

bchavez commented Feb 12, 2016

Okay, I'll have a look after I fix the build error. I've only tested ReGrid on Linux atm. Sorry for some delay, currently installing VS2015 on a VM to test your build issue.

@jakejscott
Copy link
Author

No worries at all! Just thought I'd let you know :)

@bchavez
Copy link
Owner

bchavez commented Feb 12, 2016

Out of curiosity, how large is 1.jpg? Is there a place I could grab 1.jpg to test?

@jakejscott
Copy link
Author

2,186 KB

[image: Inline image 1]

On Sat, Feb 13, 2016 at 12:45 PM, Brian Chavez notifications@github.com
wrote:

Out of curiosity, how large is 1.jpg? Is there a place I could grab 1.jpg
to test?


Reply to this email directly or view it on GitHub
#28 (comment)
.

@bchavez
Copy link
Owner

bchavez commented Feb 13, 2016

Okay, I tracked down the issue. The recent implementation of IDisposable on Cursor is prematurely closing the chunk cursor whenever LINQ is used ie: Cursor.Take(bufferSize).ToList(). Fixes coming shortly.

I'll be back in about an hour after my hike.

Meanwhile, Visual Studio is still installing the whole internet 🌐 on the VM.

@jakejscott
Copy link
Author

Nice work!!! Have an awesome weekend 💯

bchavez added a commit that referenced this issue Feb 13, 2016
@bchavez
Copy link
Owner

bchavez commented Feb 13, 2016

Hey @superlogical , basic upload and download in v2.2.5-beta-3 of the ReGrid driver should have the necessary fixes to work with windows preview alpha5.

However, upon more testing, Delete does not work with windows alpha5 (works fine under Linux). This is due to a blocking issue 💥 in rethinkdb/rethinkdb#5349 and rethinkdb/rethinkdb#5389. Delete wont work under windows RethinkDB server until these issues are fixed.

Also, thank you for reporting the issue. Please let me know if v2.2.5-beta-3 works for you. Thanks, Brian.

BTW, ReQL AST is now using .NET naming conventions. See docs for examples 👍

@jakejscott
Copy link
Author

Cool man thanks heaps. I'm keen to use Rethink on an ecommerce site I'm building. The File upload stuff is nice to have but could just use S3 or an image upload service. Will let you know if I find any problems. Appreciate your work!

@bchavez
Copy link
Owner

bchavez commented Feb 17, 2016

Hey @superlogical , the ReGrid all regrid driver tests are now working on alpha6 windows preview.

Link Here:
http://circus.atnnn.com/ipfs/QmZkxXdHE9sRhNQ91Fh418wN927GdJ2QBVnQeZLDV3LX5j/rethinkdb-windows-alpha-6.zip

I'm going to close the issue now that the ReGrid driver tests are passing. If you encounter any issues, feel free to re-open or new up an issue. 👍

@bchavez bchavez closed this as completed Feb 17, 2016
@jakejscott
Copy link
Author

No problem thanks

@jakejscott
Copy link
Author

Hey @bchavez Are these packages available for DNX Core 5.0 or DNX 4.5.1 ?

I'm still running the 2.2.5-beta-2 packages and when I try to upgrade to 2.2.5-beta-3 I get an error.

"RethinkDb.Driver": "2.2.5-beta-3",  // this is ok
"RethinkDb.Driver.ReGrid": "2.2.5-beta-2=3"  // it can't find this one

I've been running the rethinkdb 2.2.4-windows-alpha-6 (debug) and still running into issues, but I feel like it's cause I don't have the latest nuget packages

@jakejscott
Copy link
Author

Oh hold up, looks like 2.2.8-beta-2 has been published 👍

Sorry!

@bchavez
Copy link
Owner

bchavez commented Feb 18, 2016

Latest version is 2.2.8-beta-2 , could you give this one a try? Also, im in gitter. if you want to chat more

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

No branches or pull requests

2 participants