https://opendal.apache.org/ logo
facing the following error while trying to connect...
# general
s
Hi, I am facing the following error while trying to connect to local hdfs using OpenDAL with rust.
Copy code
rust
        // Create fs backend builder.
        let mut builder = Hdfs::default();
        // Set the name node for hdfs.
        builder.name_node("hdfs://127.0.0.1:9000");
        // Set the root for hdfs, all operations will happen under this root.
        //
        // NOTE: the root must be absolute path.
        builder.root("/");

        // `Accessor` provides the low level APIs, we will use `Operator` normally.
        let op: Operator = Operator::new(builder)?.finish();
        // Fetch metadata
        let meta = op.stat("output.log").await?;
        let mode = meta.mode();
        let length = meta.content_length();
The code fails at operator initialization.
Copy code
loadFileSystems error:
(unable to get stack trace for java.lang.NoClassDefFoundError exception: ExceptionUtils::getStackTrace error.)
hdfsBuilderConnect(forceNewInstance=0, nn=hdfs://127.0.0.1:9000, port=0, kerbTicketCachePath=(NULL), userName=(NULL)) error:
(unable to get stack trace for java.lang.NoClassDefFoundError exception: ExceptionUtils::getStackTrace error.)
Error: Unexpected (temporary) at  => uncategorized error

Source:
   Unknown error: 255 (os error 255)
The logs show nn as
nn=hdfs://127.0.0.1:9000, port=0
. Could somebody please help if I am missing something ?
x
Hi, NoClassDefFoundError means that some needed class are not loaded.
You can configure the classpath in this way to make sure all classes have been included:
Copy code
export HADOOP_HOME=/path/to/hadoop
export LD_LIBRARY_PATH=${JAVA_HOME}/lib/server:${LD_LIBRARY_PATH}
export CLASSPATH=$(${HADOOP_HOME}/bin/hadoop classpath --glob)
s
Thank you! Sorry for the trouble but I am still unable to run the application. It is failing with error
Copy code
warning: `opendal_test` (bin "opendal_test") generated 1 warning (run `cargo fix --bin "opendal_test"` to apply 1 suggestion)
    Finished dev [unoptimized + debuginfo] target(s) in 0.17s
     Running `target/debug/opendal_test`
2023-11-11 14:01:56,288 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[1]    88885 segmentation fault  cargo run
This is the code
Copy code
rust
use std::sync::Arc;

use opendal::Result;
use opendal::services::Hdfs;
use opendal::Operator;

#[tokio::main]
async fn main() -> Result<()> {
    // Create fs backend builder.
    let mut builder = Hdfs::default();
    // Set the name node for hdfs.
    builder.name_node("hdfs://127.0.0.1:9000");
    // Set the root for hdfs, all operations will happen under this root.
    //
    // NOTE: the root must be absolute path.
    builder.root("/");

    // `Accessor` provides the low level APIs, we will use `Operator` normally.
    let op: Operator = Operator::new(builder)?.finish();
    // Fetch metadata
    let meta = op.stat("output.log").await?;
    let mode = meta.mode();
    println!("1 - {}", mode.to_string());
    let length = meta.content_length();
    println!("2 - {}", length);

    Ok(())
}
x
Sorry for the bad experiences. Hdfs has no test cover on macOS platform. Let's find out what happened here.
First of all, can you capture the coredump and upload here?
And than, what's you hadoop version? Can you enable hadoop's logging?
You can set env that HADOOP_ROOT_LOGGER=DEBUG,console
s
Thank you! I think it was some intermittent issue. cargo clean followed by build and run worked for me. Thanks again for your help!
x
Good to hear!
By the way, would you like to share your use case to me?
I love to talk with users directly to know about their use cases so that I can know which way to go for next 😘
s
Sure, I am working on an application layer in rust which supports integration with different storage solutions such as gcs, s3 and hdfs using tokio. I was initially exploring hdrs for hdfs and would have used corresponding connectors for gcs and s3. But someone from the rust community informed me about OpenDAL and thus I am currently testing it. OpenDAL is solving exactly everything which I want for our application and once the hdfs use case is tested I will move on to s3 and gcs. The storage layer provides async functions for reading , writing, fetching metadata for data.
x
Cool!
s
Is the project looking for contributors? Could you please guide me on how to get started on contributing to this project? Thank you!
x
Yes, of course!
s
Thank you! I will take a look
x
Welcome to join in the OpenDAL community!
s
Hi, I started facing segmentation fault today as well. Used a debugger and this is the error followed by back trace. Please check if you can provide some inputs.
Copy code
shell
*[master][~/Projects/Learn/rust/opendal_test]$ ./target/debug/opendal_test
2023-11-12 12:14:36,306 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[1]    24338 segmentation fault  ./target/debug/opendal_test
Attaching debug information https://cdn.discordapp.com/attachments/1172559566924431460/1173152678390550538/message.txt?ex=6562ea92&is=65507592&hm=f78ad80eea2b78d56e69e97562284dea9f3e6016e1bed481c726cbe37f37ed12&
Multiple runs of the same binary without any changes to the code , build or env params results in variable behaviour each time on MacOS. Java 1.8 hadoop 3.2.4 opendal = { version = "0.41.0", features = ["services-hdfs"] } hdrs = {version="0.3.1", features = ["vendored"]} tokio = { version = "1", features = ["full"] }
x
Thanks for the information. I will try to digging into it.
By the way, can you share your hadoop config files? I found some error is related to the config values.
I want to try to reproduce it locally.
Can you please share what issue are you suspecting ?
x
The error showed up here:
It looks like some wrong while parsing the config but I still don't know why it's unstable reproduced.
Please try specify
hdfs-sys
in deps and enable feature
hdfs_3_3
to use the latest libhdfs vendor code.
I'm suspecting there is some bug inside the vendored libhdfs code.
s
Sure let me try with it. Thank you
Copy code
toml
[dependencies]
opendal = { version = "0.41.0", features = ["services-hdfs"] }
hdrs = {version="0.3.1", features = ["vendored"]}
hdfs-sys = {version="0.3.0", features = ["hdfs_3_3"]}
tokio = { version = "1", features = ["full"] }
x
The NPE error seems related to invalie hadoop config values.
Is
hadoop fs ls /
works?
s
Yes hdfs command works fine. Even the rust application run works fine. It’s just that the output is not consistent. It would fail sometimes and then just go through during a retry without any change made to code , environment parameters etc
In the screenshot shared above , some cargo run completed while others failed and these are subsequent retries
Could be an issue with libhdfs as you mentioned. For the same setup on an ubuntu machine I have been able to run the application consistently. There are no issues on it. I will be moving on that node for my subsequent work. Point to note : Runs are not seamless on M1 macs mostly due to the aarch64 architecture and limited native lib support.
x
Thanks for the conclusion. Would you like to submit an issue for this? Other maybe trigger this issue too and give some help. I don't have many ideas about this and can't re-produce the problem
s
2 Views