jepsen-io / jepsen

A framework for distributed systems verification, with fault injection
6.68k stars 710 forks source link

Error thrown for tutorial code: Can't define method not in interfaces: su #499

Closed zhangysh1995 closed 3 years ago

zhangysh1995 commented 3 years ago

I was at the step of Installing the DB, and I got the following error:

Caused by: java.lang.IllegalArgumentException: Can't define method not in interfaces: su
        at clojure.lang.Compiler$NewInstanceMethod.parse(Compiler.java:8528)
        at clojure.lang.Compiler$NewInstanceExpr.build(Compiler.java:8058)
        at clojure.lang.Compiler$NewInstanceExpr$ReifyParser.parse(Compiler.java:7959)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:7106)
        ... 58 more

su is introduced in :

(def dir "/opt/etcd")

(defn db
  "Etcd DB for a particular version."
  [version]
  (reify db/DB
    (setup! [_ test node]
      (info node "installing etcd" version)
      (c/su ; <- here is the error site
        (let [url (str "https://storage.googleapis.com/etcd/" version
                       "/etcd-" version "-linux-amd64.tar.gz")]
          (cu/install-archive! url dir))))

    (teardown! [_ test node]
      (info node "tearing down etcd"))))

I could exec lein run test and everything works fine before adding code for this step. This issue may be related to #441.

I'm running Jepsen inside the provided docker container and here is the environment:

# java --version
openjdk 11.0.9.1 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-post-Debian-1deb10u2)
OpenJDK 64-Bit Server VM (build 11.0.9.1+1-post-Debian-1deb10u2, mixed mode, sharing)
# javac --version
javac 11.0.9.1

# cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Maybe we should consider using a previous release of Debian for the Dockerfile?

zhangysh1995 commented 3 years ago

I tried to change the os to stretch but it seems many apt install will break on it:

E: Unable to locate package openjdk-11-jdk-headless
ERROR: Service 'control' failed to build: The command '/bin/sh -c apt-get -y -q update &&     apt-get install -qy openjdk-11-jdk-headless     libjna-java     vim     emacs     git     htop     screen     pssh     curl     wget     gnuplot     graphviz     dos2unix' returned a non-zero code: 100
E: Unable to locate package apt-transport-https                                                                                       
ERROR: Service 'n3' failed to build: The command '/bin/sh -c apt-get install -y apt-transport-https' returned a non-zero code: 100  
aphyr commented 3 years ago

This is a syntax error--changing the operating system isn't going to help. I can't tell from the snippet you've posted why this isn't working, but I suspect it's something to do with putting an (su ...) directly inside a (reify) or (defrecord).--KyleOn Feb 5, 2021 01:50, Yushan ZHANG notifications@github.com wrote: I tried to change the os to stretch but it seems many apt install will break on it: E: Unable to locate package openjdk-11-jdk-headless ERROR: Service 'control' failed to build: The command '/bin/sh -c apt-get -y -q update && apt-get install -qy openjdk-11-jdk-headless libjna-java vim emacs git htop screen pssh curl wget gnuplot graphviz dos2unix' returned a non-zero code: 100

E: Unable to locate package apt-transport-https
ERROR: Service 'n3' failed to build: The command '/bin/sh -c apt-get install -y apt-transport-https' returned a non-zero code: 100

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.

zhangysh1995 commented 3 years ago

I have re-typed all the code and this error was gone. Thanks for your reply.