fast scala compiler: Unable to establish connection to compilation daemon - scala

I have a ubuntu machine under OpenVZ virtualization. When I run fsc test.scala I get:
Unable to establish connection to compilation daemon
Then ps aux shows me lots of processes that look like this
ren 17482 0.0 0.0 4908 1400 pts/0 S 00:29 0:00 /bin/bash --posix /usr/bin/scala -Djava.net.preferIPv4Stack=true scala.tools
ren 17490 0.2 0.5 1246676 24268 pts/0 Sl 00:29 0:00 java -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Stack=true -Xbootc
I have run out of ideas how to make it work, version is Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL. Any ideas?
Edit:
Found this, so:
selinux is not installed
export | grep SCALA doesn't return
anything, however scalac and scala compiling/running fine so I assume
this step is ok
ping localhost - works
fsc -reset - same error
fsc -verbose >> logfile.log 2>&1 produces this:
Fast Scala compiler version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL
[Given arguments: -verbose]
[Transformed arguments: -verbose -current-dir /home/ren]
[VM arguments: ]
[Temp directory: /tmp/scala-devel/ren]
[Port number: 36737]
java.net.SocketException: Invalid argument or cannot assign requested address
[Connecting to compilation daemon at port 36737 failed; re-trying...]
No compile server running: starting one with args ''
[Executing command: scala scala.tools.nsc.CompileServer -v]
Starting CompileServer on port 34962
Redirect dir is /tmp/scala-devel/ren/output-redirects
[Port number: 34962]
java.net.SocketException: Invalid argument or cannot assign requested address
[Connecting to compilation daemon at port 34962 failed; re-trying...]
[Port number: 34962]
java.net.SocketException: Invalid argument or cannot assign requested address
[Connecting to compilation daemon at port 34962 failed; re-trying...]
No compile server running: starting one with args '' and so on ...
Edit 2:
Well, starting compilation server like this scala scala.tools.nsc.CompileServer -v actually works! And it seems fsc did start all those servers, but for some reason it decided it didn't. fsc -server localhost:port test.scala works. Which is good enough for now.

It seems fsc uses hostname to connect to compilation server. My hostname didn't response to ping. Changing it to localhost in /etc/hostname fixed the problem.

Related

How to fix "pytest: error: unrecognized arguments: -n"

Hi I am trying to run my tests parallely(pytest-xdist) on the azure pipelines.
Till now the tests were running perfectly fine.
Suddenly the pytest is throwing a weird error saying "unrecognized argument".
The file name : integration_test.py
Command used : pytest -n 5 --tb=short integration_test.py -v -s --> to run 5 tests parallely
Total number of tests : 57
Versions :
pytest==6.2.5
pytest-xdist==2.3.0
Even tried with the latest versions of these 2 modules.
Error :
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: -n integration_test.py
How can I overcome this error?
This error is what you encountered:
As hoefling mentioned, the solution is to install the pytest-xdist:
pip install pytest-xdist
On MacOS just running pytest might be ran by a different Python's version than you thought.
$ pytest
============================================================================== test session starts ===============================================================================
platform darwin -- Python 3.9.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.1
rootdir: [REDACTED]
plugins: anyio-3.5.0, cov-3.0.0
While
$ python3 -m pytest
============================================================================== test session starts ===============================================================================
platform darwin -- Python 3.10.6, pytest-7.1.2, pluggy-1.0.0
rootdir: [REDACTED]
plugins: xdist-2.5.0, forked-1.4.0, pylama-8.4.1
Be careful, and launch it as a module :)

eclipse CDT esp-idf build but don't flash

Windows10 eclipse esp-idf latest version 2021-03
With the command line idf.py I can build and flash the esp-idf\examples\get-started\blink programme which run on a ESP32.
In eclipse, the buils works but the run command display in console
Usage: C:\Users\peter\esp-idf\tools\idf.py [OPTIONS] COMMAND1 [ARGS]...
[COMMAND2 [ARGS]...]...
ESP-IDF CLI build management tool. For commands that are not known to
idf.py an attempt to execute it as a build system target will be made.
.... bla bla ...
Can anybody tells me what is wrong ?
Regards
There is a bug in the eclipse/esp-idf launch bar.
The ESP target for esp32 is defined with a Serial Port COM3.
But that info is not used.
If one redefine a new ESP Target with the same serial port under a different name, then the run command will work!
See hereafter for the people interested in the details
cmd.exe /C "cd /D C:\Users\peter\esp-idf\components\esptool_py && C:\Users\peter.espressif\tools\cmake\3.16.4\bin\cmake.exe -D IDF_PATH="C:/Users/peter/esp-idf" -D ESPTOOLPY="C:\Users\peter.espressif\python_env\idf4.2_py3.8_env\Scripts\python.exe C:/Users/peter/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32" -D ESPTOOL_ARGS="--before=default_reset --after=hard_reset write_flash #flash_args" -D WORKING_DIRECTORY="C:/Users/peter/eclipse-workspace/blink/build" -P C:/Users/peter/esp-idf/components/esptool_py/run_esptool.cmake"
esptool.py --chip esp32 -p COM3 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x1000 bootloader/bootloader.bin 0x10000 blink.bin
esptool.py v3.0

nmap could not locate nse_main.lua

When I try to use the following
nmap -p 443 -Pn --script=ssl-cert ip_address
I get the following error:
Starting Nmap 7.70 ( https://nmap.org ) at 2019-06-04 15:20 UTC
NSE: failed to initialize the script engine:
could not locate nse_main.lua
stack traceback:
[C]: in ?
QUITTING!
the response for nmap --version
is
Nmap version 7.70 ( https://nmap.org )
Platform: x86_64-alpine-linux-musl
Compiled with: liblua-5.3.5 openssl-1.1.1a libssh2-1.8.0 libz-1.2.11 libpcre-8.42 libpcap-1.9.0-PRE-GIT nmap-libdnet-1.12 ipv6
Compiled without:
Available nsock engines: epoll poll select
You need to install the package nmap-scripts as well, as this is not installed automatically on Alpine (see here).
So simply run apk add nmap-scripts or add it to your dockerfile.

Installing WWW::Mechanize – Error GETing localhost: Can't connect to localhost

I am using the command
sudo perl -MCPAN -e 'install WWW::Mechanize'
to try and install WWW::Mechanize on macOS, and kept getting the error
1/13 Error GETing http://localhost:51623/: Can't connect to localhost:51623 (Connection refused) at t/local/referer.t line 39.
I somewhat fixed this by changing the file /etc/hosts by adding a -v6 at the end of the second instance of the word "localhost". /etc/hosts now reads
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost-v6
Now, at the end of the installation process, I get this Test Summary Report:
t/live/wikipedia.t (Wstat: 512 Tests: 1 Failed: 0)
Non-zero exit status: 2
Parse errors: No plan found in TAP output
Files=58, Tests=608, 69 wallclock secs ( 0.25 usr 0.11 sys + 8.25 cusr 1.28 csys = 9.89 CPU)
Result: FAIL
Failed 1/58 test programs. 0/608 subtests failed.
make: *** [test_dynamic] Error 255
OALDERS/WWW-Mechanize-1.78.tar.gz
/usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports OALDERS/WWW-Mechanize-1.78.tar.gz
Running make install
make test had returned bad status, won't install without force
How can I install WWW::Mechanize?
The (only) failed test I get when installing without force failed due to the certificate authenticity of the wikipedia page that was being used. After force installing WWW::Mechanize, the module works fine.
If you don't need IP v6, remove it from your 'hosts' file. But to me doesn't make any sense CPAN are trying to get modules from 'localhost' because of this. Anyways, remove that 'ip v6 thing' from your host and try again, please!

Installing SBT an Mac OSX 10.6

I am trying to get SBT running on my Mac Operating System.
So far, I downloaded the Jar-Launcher and installed in into the /bin folder.
Then I created a SBT script, containing the following lines:
export PATH=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin:$PATH
java -Xmx512M -jar ` $0` /bin/sbt-launch-0.7.7.jar "$#"
When I call SBT on the Console, I receive the following series of error messages:
> /bin/sbt: fork: Resource temporarily unavailable
java.io.IOException: Cannot run program "sh": error=35, Resource temporarily unavailable
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:466)
at jline.UnixTerminal.exec(UnixTerminal.java:297)
at jline.UnixTerminal.exec(UnixTerminal.java:282)
at jline.UnixTerminal.stty(UnixTerminal.java:273)
at jline.UnixTerminal.initializeTerminal(UnixTerminal.java:77)
at jline.Terminal.setupTerminal(Terminal.java:75)
at jline.Terminal.getTerminal(Terminal.java:26)
at xsbt.boot.JLine$.terminal(SimpleReader.scala:20)
at xsbt.boot.JLine$.createReader(SimpleReader.scala:22)
at xsbt.boot.SimpleReader$.<init>(SimpleReader.scala:42)
at xsbt.boot.SimpleReader$.<clinit>(SimpleReader.scala)
at xsbt.boot.Initialize$.create(Create.scala:17)
at xsbt.boot.Launch$.parsed(Launch.scala:28)
at xsbt.boot.Launch$.configured(Launch.scala:21)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Launch$.apply(Launch.scala:13)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.run(Boot.scala:19)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
Caused by: java.io.IOException: error=35, Resource temporarily unavailable
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:53)
at java.lang.ProcessImpl.start(ProcessImpl.java:91)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 21 more
What is going wrong here?
Looks like you have a stray $0 there (which is expanded to the name of the current process sh). Try
java -Xmx512M -jar /bin/sbt-launch-0.7.7.jar "$#"
instead. That should get you up and running. The usual way is to call sbt like so:
java -Xmx512M -jar `dirname $0`/sbt-launch.jar "$#"
supposed you have the shell script sbt in the same folder as sbt-launch.jar because that is where dirname $0 points at.