coffee-tools / coffee

Reference implementation for a flexible core lightning plugin manager
https://docs.page/coffee-tools/coffee
9 stars 13 forks source link

coffee is not able to recover from cln missing #209

Closed vincenzopalazzo closed 6 months ago

vincenzopalazzo commented 9 months ago

Let's imagine that I have my core lightning in an external SSD, and I do not have it plugged.

This is the log that I found inside my machine by running RUST_LOG=debug coffee remote list

It produces the following error

Error: CoffeeError { code: 1, msg: "No such file or directory (os error 2)" }

This is the log that it produces before returning the error

➜  cln-passip git:(master) RUST_LOG=debug coffee remote list
[2023-10-17T10:02:54Z INFO  coffee_core::config] creating coffee home at /home/vincent/.coffee
[2023-10-17T10:02:54Z DEBUG sled::pagecache::iterator] ordering before clearing tears: {0: 0}, max_header_stable_lsn: 0
[2023-10-17T10:02:54Z DEBUG sled::pagecache::iterator] in clean_tail_tears, found missing item in tail: None and we'll scan segments {0: 0} above lowest lsn 0
[2023-10-17T10:02:54Z DEBUG sled::pagecache::iterator] filtering out segments after detected tear at (lsn, lid) 22158
[2023-10-17T10:02:54Z DEBUG sled::pagecache::iterator] hit max_lsn 22158 in iterator, stopping
[2023-10-17T10:02:54Z DEBUG sled::pagecache::snapshot] zeroing the end of the recovered segment at lsn 0 between lids 22159 and 524287
[2023-10-17T10:02:54Z DEBUG sled::pagecache::blob_io] gc_blobs removing any blob with an lsn above 22159
[2023-10-17T10:02:54Z DEBUG sled::pagecache::segment] SA starting with tip 524288 stable -1 free {}
[2023-10-17T10:02:54Z DEBUG sled::pagecache::iobuf] starting log at recovered active offset 22159, recovered lsn 22159
[2023-10-17T10:02:54Z DEBUG sled::pagecache::iobuf] starting IoBufs with next_lsn: 22159 next_lid: 22159
[2023-10-17T10:02:54Z DEBUG sled::pagecache] load_snapshot loading pages from 0..4
[2023-10-17T10:02:54Z DEBUG coffee_core::coffee] repositories in store {"folgore-git": Repository { kind: Git, name: "folgore-git", url: URL { name: "folgore-git", url_string: "https://github.com/coffee-tools/folgore", path_string: "/home/vincent/.coffee/repositories/folgore-git", repo_name: "folgore.git" }, plugins: [Plugin { name: "folgore", root_path: "/home/vincent/.coffee/repositories/folgore-git", exec_path: "/home/vincent/.coffee/repositories/folgore-git/target/release/folgore_plugin", lang: Rust, conf: Some(Conf { plugin: Plugin { name: "folgore", version: "0.0.1", lang: "rust", deprecated: None, dependencies: None, install: Some("make coffee\n"), main: "target/release/folgore_plugin" } }), commit: Some("0f7a71b0d245cc3b180f8f4c35862df8cb799d87") }], branch: "main", git_head: Some("0f7a71b0d245cc3b180f8f4c35862df8cb799d87"), last_activity: Some("28/09/2023") }, "lnmetrics-git": Repository { kind: Git, name: "lnmetrics-git", url: URL { name: "lnmetrics-git", url_string: "https://github.com/LNOpenMetrics/go-lnmetrics.reporter", path_string: "/home/vincent/.coffee/repositories/lnmetrics-git", repo_name: "go-lnmetrics.reporter.git" }, plugins: [Plugin { name: "lnmetrics", root_path: "/home/vincent/.coffee/repositories/lnmetrics-git", exec_path: "/home/vincent/.coffee/repositories/lnmetrics-git/go-lnmetrics", lang: Go, conf: Some(Conf { plugin: Plugin { name: "lnmetrics", version: "0.0.6-rc2", lang: "go", deprecated: None, dependencies: None, install: Some("make dep\nmake coffee\n"), main: "go-lnmetrics" } }), commit: Some("5ad4c0fb9326950fc5887556d6cc0de73eb91d76") }], branch: "main", git_head: Some("5ad4c0fb9326950fc5887556d6cc0de73eb91d76"), last_activity: Some("12/06/2023") }}
[2023-10-17T10:02:54Z DEBUG coffee_core::nurse::strategy] Checking if repository folgore-git exists locally
[2023-10-17T10:02:54Z DEBUG coffee_core::nurse::strategy] Checking if repository lnmetrics-git exists locally
[2023-10-17T10:02:54Z DEBUG coffee_core::nurse::strategy] No repositories missing locally
[2023-10-17T10:02:54Z DEBUG coffee_core::coffee] Chain of responsibility status: ChainOfResponsibilityStatus { defects: [] }
[2023-10-17T10:02:54Z INFO  coffee_core::coffee] looking for the cln config: /run/media/vincent/VincentSSD/.lightning/bitcoin/config
[2023-10-17T10:02:54Z DEBUG sled::pagecache::logger] IoBufs dropped

@tareknaser Do you think that this is a good strategy to add inside the nurse command? We can suggest rerunning the lightning

tareknaser commented 9 months ago

@tareknaser Do you think that this is a good strategy to add inside the nurse command? We can suggest rerunning the lightning

I think this deserves a proper error message. If this to be a nurse handler. What is the action to be taken?

vincenzopalazzo commented 9 months ago

If this to be a nurse handler. What is the action to be taken?

Re-run the coffee setup command?

tareknaser commented 9 months ago

Re-run the coffee setup command?

But how would we know the true path to lightning? Maybe we can suggest to the user running coffee setup with the correct lightning path

vincenzopalazzo commented 9 months ago

Nurse command should not fix the problem in this case.

Maybe we can suggest to the user running coffee setup with the correct lightning path

Correct