mongo-rs icon indicating copy to clipboard operation
mongo-rs copied to clipboard

Building mongod on a single core Ubuntu has been hanging.

Open mzdk100 opened this issue 1 year ago • 5 comments

The cargo process keeps waiting and will not end unless it is terminated using Ctrl+C.

...
Compiling mongodb v2.8.2

mzdk100 avatar Aug 20 '24 09:08 mzdk100

I am not able to replicate are you able to provide a minimal example that can reproduce the hang? I tried it in Ubuntu Jammy with the example on the README.md using rust 1.80.1 and it compiles without hanging.

alexkornitzer avatar Aug 22 '24 18:08 alexkornitzer

Hi, I am also running an example in the README:

use futures::stream::StreamExt;
use mongod::{Bson, Mongo};
use mongod::{AsFilter, AsUpdate, Collection, Comparator, Updates};

#[derive(Debug, Bson, Mongo)]
#[mongo(collection = "users", field, filter, update)]
pub struct User {
  pub name: String,
  pub age: Option<u32>,
}

#[tokio::main]
async fn main() {
  // Create and async client
  let client = mongod::Client::new();

  // Insert a user into the users collection
  let user = User { name: "foo".to_string(), age: None };
  let oid = client.insert_one::<User>(user).await.unwrap();
  println!("{:?}", oid);

  // Fetch all users in the users collection
  let mut cursor = client.find::<User, _>(None).await.unwrap();
  while let Some(res) = cursor.next().await {
      if let Ok((id, user)) = res {
          println!("{} - {:?}", id, user);
      }
  }

  // Update the user
  let mut filter = User::filter();
  filter.name = Some(Comparator::Eq("foo".to_owned()));
  let mut update = User::update();
  update.age = Some(Some(0));
  let updates = Updates {
      set: Some(update),
      ..Default::default()
  };
  let updated = client.update::<User, _, _>(filter, updates).await.unwrap();
  println!("updated {} documents", updated);

  // Delete all users
  let deleted = client.delete::<User, _>(None).await.unwrap();
  println!("delete {} documents", deleted);
}

There will be a suspension situation, and I will send the SSH login information of my server to your email later. The path to the example directory is:/home/ubuntu/hello, thank you.

mzdk100 avatar Aug 22 '24 23:08 mzdk100

Hey! You might want to give more information about your environment, the amount of disk space, ram, etc. If you're building in a vps then it could also be something with that environment and not with the project itself.

dariusc93 avatar Aug 22 '24 23:08 dariusc93

Hey @mzdk100, thanks for the trust in proposing to let me SSH into your server but really if at all, that should be a last resort. I would prefer to replicate locally than to SSH into an unknown box. I think as @dariusc93 has suggested providing the RAM, cargo/rust versions, OS version and disk space would be a better first step.

alexkornitzer avatar Aug 24 '24 08:08 alexkornitzer

It's okay, you can help connect and troubleshoot it, which will also make it easier to reproduce the problem. The main issue is that this problem may be rare, and even if I tell you this information, it will be difficult for you to find a machine with the same configuration.

mzdk100 avatar Aug 24 '24 11:08 mzdk100