debug openresty with zerobrane - lua

I've followed this tutorial to setting up Zerobrane IDE for debugging openresty:
http://notebook.kulchenko.com/zerobrane/debugging-openresty-nginx-lua-scripts-with-zerobrane-studio.
I installed openresty 1.19.3.1 from a brew formula, and lua scripts are working.
Double checked everything with zerobrane, the error i got:
Debugger server started at vgh.local:8172.
Can't start debugging for '/usr/local/Cellar/openresty/1.19.3.1_1/nginx/lua/content.lua'. Compilation error:
Debugger connection closed
Debugging session completed (traced 0 instructions).
Refused a request to start a new debugging session as there is one in progress already.
What should i check?
This is the conf i have on macos, but i got the same error on a linux (ubuntu 20.10):
lua_package_path '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/?/?.lua;/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/?.lua;;';
lua_package_cpath '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/clibs/?.dylib;;';

You don't say what version of ZeroBrane Studio you are using, but you'll need to use the latest one from the master branch in the repository, as there have been several openresty-related fixes applied to the debugger and merged recently .

Related

Build fails intermittently on Jenkins node machine

I created a build system on windows 2019 server where I installed Jenkins version 2.375.1 and which is running Java 17. I am completely new in this and doing it for first time.
Here is the issue: Whenever I run any job, sometime s(4-6 out of 10) it fails by throwing an exception. See below :
java.nio.channels.ClosedChannelException
at jenkins.agents.WebSocketAgents$Session.closed(WebSocketAgents.java:153)
at jenkins.websocket.WebSockets$1.onWebSocketClose(WebSockets.java:80)
at jenkins.websocket.Jetty10Provider$2.onWebSocketClose(Jetty10Provider.java:149)
at org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandler.notifyOnClose(JettyWebSocketFrameHandler.java:308)
at org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandler.onClosed(JettyWebSocketFrameHandler.java:292)
at org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession.lambda$closeConnection$0(WebSocketCoreSession.java:272)
at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1450)
at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1487)
at org.eclipse.jetty.websocket.core.server.internal.AbstractHandshaker$1.handle(AbstractHandshaker.java:212)
at org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession.lambda$closeConnection$1(WebSocketCoreSession.java:272)
at org.eclipse.jetty.util.Callback$4.completed(Callback.java:184)
at org.eclipse.jetty.util.Callback$Completing.succeeded(Callback.java:344)
at org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandler.onError(JettyWebSocketFrameHandler.java:268)
at org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession.lambda$closeConnection$2(WebSocketCoreSession.java:284)
at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1468)
at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1487)
............
............
............
And the log I got in node machine on console is :
INFO: Connected
Jan 15, 2023 8:05:02 AM hudson.remoting.UserRequest perform
WARNING: LinkageError while performing
UserRequest:hudson.node_monitors.SwapSpaceMonitor$MonitorTask#4c55cc1c
java.lang.UnsatisfiedLinkError: C:\Users\test*****\AppData\Local\Temp\jna--202642030\jna2121667260400486382.dll: A dynamic link library (DLL) initialization routine failed
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
at java.base/java.lang.Runtime.load0(Runtime.java:755)
at java.base/java.lang.System.load(System.java:1953)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1045)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:1015)
at com.sun.jna.Native.<clinit>(Native.java:221)
at com.sun.jna.Structure.setAlignType(Structure.java:291)
at com.sun.jna.Structure.<init>(Structure.java:208)
at com.sun.jna.Structure.<init>(Structure.java:204)
at com.sun.jna.Structure.<init>(Structure.java:191)
at com.sun.jna.Structure.<init>(Structure.java:183)
at org.jvnet.hudson.Windows$MEMORYSTATUSEX.<init>(Windows.java:67)
Some more info about configuration :
Both controller and node machine is windows server 2019
Since in latest Jenkins the java web connect(Run Jenkins as service on node) is not available so directly running the agent command in node's CLI.
Both controller and node is running Java v17
I went through couple of links and tried all the possible suggestion provided like power management settings on salve machine, increasing Jenkins build timeout settings etc... but no luck.
Any help on this is highly appreciated.
Thanks.
Not sure if there is a bug in Jenkins itself or something. I could not find the answer of the exact issue but after making some changes in jenkins configuration, now i am able to run all the jobs without getting above exception.
Here it is : Earlier i checked jenkins to use websocket in slave configuration. If i just disable it and run then not getting any issue.
Just disbaling this worked for me.. Thanks.

Visual Studio Code do not start over Docker Desktop

After upgrading Docker/Docker-Desktop to 4.0.0
i'm not able to start Visual Studio Code over Docker-Desktop.
Docker Desktop show an error: Error invoking remote method 'desktop-go-backend': Error: Internal Server Error
and if i start Visual Studio Code not over Docker Desktop, Visual Studio Code can not connect to WSL.
Console Output come with an error like this:
/home/xxxx/.vscode-server/bin/xxxxxxxxxxxxxxxxxxxxxxxxxx/bin/code: not found
After searching in outer issues with VS Code and WSL, i found the solution for me:
I delete the directory: /home/xxxxx/.vscode-server/ in the WSL/Distribution
because the directory /home/xxxxx/.vscode-server/bin/xxxxxxxxxxxxxxxxxxxxxxxxxx/ was empty
After deleting the directory and restart VS Code the needed files are reinstalled and all working like before.
I had an issue with a similar message:
Error invoking remote method 'desktop-go-backend': [object Object]
I managed to fix this by removing the spaces in my source code folder.

Stack window shows no output when debugging Redis Lua scripts with ZeroBrane

I have followed this tutorial to debug Redis Lua scripts.
https://www.youtube.com/watch?v=7mlajCj4QPw
Everything works except for that the Stack window shows no output so I can't see the value of the variables which is what I need to debug. If I change the Lua interpreter to something else than redis, and try to debug some normal Lua code then it works, and stack window shows everything. But once I switch to Redis as Lua interpreter then nothing shows on the Stack window.
I load up the redis.lua plugin from this repository
as suggested in the video:
https://github.com/pkulchenko/ZeroBranePackage
Stack Window is empty as you can see:
What could be wrong?
Also for some reason when I enter GET foo in the remote console it says:
"Wrong number of args calling Redis command From Lua script"
Since I have redis running on another machine, I thought perhaps I had to change some settings:
debugger.hostname = "192.168.0.161"
debugger.port = 8172
When I try to run it it says:
Can't connect to the debugger at '192.168.0.161:8172': connection refused
Do I have to do something special to the redis settings on my Virtual Linux Box to remote debug Redis? I am using Windows 7 so I can't install Redis 3.2 on it to debug so I have to run it on Cent OS 7 on VirtualBox.
Both of these issues (empty stack window and an error on Redis commands in console) should be fixed in the updated version of Redis plugin (0.33).

Nuget gives the error "ps1 cannot be loaded because running scripts is disabled"

I have a new empty MVC 5 project, and I try to install Nuget packages.
When I insert in the Nuget Console the command :Update-Package I got the following asnwer:
File E:\WebApp\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\tools\uninstall.ps1 cannot be loaded because running scripts is
disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.At line:1 char:3
+ & 'E:\WebApp\packages\Microsoft.CodeDom.Providers.Dot ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
then I start to install some new packages and got again this message:
WebApp\packages\Modernizr.2.8.3\tools\install.ps1 cannot be loaded because running scripts is disabled on this system
I saw some posts related with this message, but not related with MVC projects.
My question is:
Why I get those messages?
What can I do to fix this issue?
This issue, can appear on the server where my application will run? Some scripts to not run as expected?
I guess the specific package you are trying to install needs to run a Powershell script and for some reason, Powershell execution is disabled on your machine.
You can search google on "how to enable Powershell" for a complete guide but generally, it goes like this:
Open up a Powershell command window (just search for Powershell after pressing windows start button)
Check out current restrictions by typing Get-ExecutionPolicy
Enable PowerShell by typing Set-ExecutionPolicy remotesigned
This issue does not affect the server you are planing to install your application on.
If you encounter this installing NuGet packages from Visual Studio Package Manager Console, run Visual Studio as Administrator.
In case anybody finds this on Google and this happened to you, I suggest you first try restarting Visual Studio, particularly if the Package Manager Console has worked for you before. In VS 2019, I've noticed that, if I leave it in the background while it's loading, sometimes it'll throw that error.
For me, restarting Visual Studio and leaving it in the foreground until the Package Manager Console finished initializing solved the issue. Note that running it as administrator was not necessary.
Translation of the image text would be somewhat: This certificate has been revoked from its key store.
Certificate on my init.ps1 has expired - thus RemoteSigned will not do. For that package version to work, it would need to be set to ByPass or Unrestricted. Personally, i would not recommend doing this...
-- EDIT --
I went ahead and updated the package and found they have resigned a new cert for v 1.0.2. Issue following in NuGet console for fix:
Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
open your power-shell as administration and type
Get-ExecutionPolicy
Expected result RemoteSigned
Set-ExecutionPolicy remotesigned
if it does not work, try Powershell run in administrator
I ran into a similar issue building a project and found that you MAY have to set the execution policy to remoteSigned (as others have mentioned) in BOTH powershell (x86) and powershell (x64). I was running the x64 version as administrator and Get-ExecutionPolicy returned "remoteSigned" but the x86 version hadn't been updated. Just something to try if the above answers don't work for you.
This should work
open your power-shell as administration and type
Get-ExecutionPolicy
Expected result RemoteSigned
Set-ExecutionPolicy remotesigned
Enjoy
A quick to fix this error when using Package Manager Console without VS restart and/or running as Admin is to remove the restriction for current user:
Set-ExecutionPolicy remotesigned -scope CurrentUser

Ejabbered installation issue for Windows

I tried to install ejabberd 2.1.11 for windows on my Windows system, but at the final stage of installation it given post installation error. Couple of some of the last lines in the intallation logs says:
***Executing final installation script
Error executing post installation script
C:\Program Files (x86)\ejabberd-2.1.11\bin\postinstall.cmd
./ejabberdctl: erl.exe: can't execute: (14001) Error 14001
Creating Uninstalle***r
Though the shortcuts are created on the system but trying to start the server gives following error
./ejabberdctl: erl.exe: can't execute: (14001) Error 14001
The VC++ 2008 is already installed on the system. While searching I found the following post on stackoverflow:
How to install ejabberd community version on Windows XP?
But this too did not help. Has anyone else encountered the same scenario? Your suggestion would be greatly appreciated.

Resources