From users-return-7594-archive-asf-public=cust-asf.ponee.io@trafficserver.apache.org Fri Mar 8 16:15:57 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 653A7180626 for ; Fri, 8 Mar 2019 17:15:56 +0100 (CET) Received: (qmail 59759 invoked by uid 500); 8 Mar 2019 16:15:55 -0000 Mailing-List: contact users-help@trafficserver.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@trafficserver.apache.org Delivered-To: mailing list users@trafficserver.apache.org Received: (qmail 59743 invoked by uid 99); 8 Mar 2019 16:15:55 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Mar 2019 16:15:55 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id CC793C0681 for ; Fri, 8 Mar 2019 16:15:54 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.201 X-Spam-Level: X-Spam-Status: No, score=-0.201 tagged_above=-999 required=6.31 tests=[DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id Vi19Mzgol0Fz for ; Fri, 8 Mar 2019 16:15:52 +0000 (UTC) Received: from mail-it1-f172.google.com (mail-it1-f172.google.com [209.85.166.172]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 48F625F4D5 for ; Fri, 8 Mar 2019 16:15:52 +0000 (UTC) Received: by mail-it1-f172.google.com with SMTP id e24so21649386itl.1 for ; Fri, 08 Mar 2019 08:15:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=lWaZ8hhpzGDneKX2zy0TBVby3sfRLd2l7IofMjWFxXI=; b=MUfLOm5c/ovwF5wUAp1jA6bVLve8gYUQuK+zOovw1rlAkR++cWRR66WMAuHOnZC9kT j/dKMOuuLnlbDy3wfg6RbXmn/LAZI/2QgLEyC8eTAnRS/XqA1xeRpcRgp0VtQ2mBWmhb Sg7COCHFGikEKudu1Be+aQKt5BZXx4MPoaLToJ2JYOQaGk3TBQEYPlcOPUEa5fgKH9V0 9IJK0LrOgN/0QMGn6+DUwSRKX5ofvHWnI8i1hoocuh4z5d4k5qD4LhIWmQXuu/Ti5Acd T9YA6t5EN2Nqg27BxBWP4QlGpubsHKF3DsfMrygeSVY97IcjwqGpR2H9DsZnQS54siTI fdQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=lWaZ8hhpzGDneKX2zy0TBVby3sfRLd2l7IofMjWFxXI=; b=Kfg/AmCMvxZvAOFdJzKP7dTMA/U+i6/UhBs7iZ2e6xCbd7aG5ExiEyc+zL9nI7+TUw sjnQ7NzOadDcxFEZ+GKNFyHuG/wX46SSARTy23/ckwXpDc6Fvp9BhUNuCot5wcPtUEyi fiOXRCYM9ToaDvar2Lh4p81nsM8xwX82Dxxpu3rpRb0Lze6YxwF1HY3tDQZ7ooRV6GB5 GayBnrS5IYuo7UxknMU+VTuB/119DtMpqUcw0r7yJORsuScYcyYvUlPfgk7PuFbtBwJg b+IYbSNRi2U2tHCmlENk3ir34x5RpNXq83cd/bclK/CjP3nEIV8bHb7W7yLISQXdzHv6 3Swg== X-Gm-Message-State: APjAAAWjsayYG3AF4O7y3Xzo+GbrdA3NSmkLMtsQBxQzOfZdQheSPnso BeLJMYAxtdotcuF9zLl9ecFHdpfDZjGl+sRSpQyYquO7 X-Google-Smtp-Source: APXvYqwt1rfNQMniileoH277lAYJSIRan8VphUfsHAp+Lc0VnRLgRmkWPqmffNpZCiSZ2bCkhaaCknzlbg05ZZ9yspU= X-Received: by 2002:a02:5f9d:: with SMTP id x29mr11352989jad.74.1552061744982; Fri, 08 Mar 2019 08:15:44 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Shu Kit Chan Date: Fri, 8 Mar 2019 08:15:34 -0800 Message-ID: Subject: Re: ts_lua error after using ts.add_package_path To: users@trafficserver.apache.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I am not sure what's wrong with your setup. i have used luasocket before with no problem. perhaps this will shed some light ? https://github.com/diegonehab/luasocket/issues/158 https://github.com/diegonehab/luasocket/issues/87 Thanks. Kit On Thu, Mar 7, 2019 at 6:59 AM Eric Chaves wrote: > > Nice!, It solved this error but now I got the error "ERROR: [ts_lua] lua= _pcall failed: error loading module 'socket.core' from file '/opt/ats/lua_m= odules/lib/lua/5.1/socket/core.so': /opt/ats/lua_modules/lib/lua/5.1/socket= /core.so: undefined symbol: lua_gettop. > > Everything was built using lua 5.1. Any clues why I could be getting the = undefined symbol? Could I be missing some dependency? > > Em qua, 6 de mar de 2019 =C3=A0s 18:37, Shu Kit Chan escreveu: >> >> Try not to call "add_package_path" / "add_package_cpath" inside the >> lua module . >> Call them in the same lua file containing the do_remap() function and >> see if your problem is solved. >> >> Kit >> >> On Wed, Mar 6, 2019 at 1:23 PM Eric Chaves wrote: >> > >> > Hi folks, >> > >> > This may be a little off-topic. Not sure if questions regarding lua pl= ugins/lua scripts should be asked here in the list. If so forgive me and pl= ease point me the proper place to ask. >> > >> > I'm trying to learn TS lua script's. At first I just followed the samp= le code for reverse host header presented in the lua_plugin docs by writing= a module named my_module.lua required inside a do_remap() with the followi= ng content: >> > >> > local my_module =3D {} >> > function my_module.send_response() >> > ts.debug('executing my_module.send_response') >> > ts.client_response.header['Rhost'] =3D ts.ctx['rhost'] >> > return 0 >> > end >> > return my_module >> > >> > This works fine and after that I tried to add some code to connect int= o a local redis instance using libs installed by luarocks (eg.: luarocks in= stall --tree /opt/ats/lua_modules luasocket) >> > >> > I found some scripts at github that uses the ts.add_package_path to i= nclude the new modules and based on them I added those two lines at the top= of my_module.lua: >> > >> > ts.add_package_path('/opt/ats/lua_modules/share/lua/5.1/?.lua;/opt/ats= /lua_modules/share/lua/5.1/?/init.lua') >> > ts.add_package_cpath('/opt/ats/lua_modules/share/lua/5.1/?.so') >> > >> > By doing so, even without actually requiring any new module (ie no oth= er changes in my_module logic) when my do_remap tries require my_module, I = got an error: ERROR: [ts_lua] lua_pcall failed: /opt/ats/lua-plugins/my_mod= ule.lua:6: can't get the instance conf >> > >> > So it's clear that I'm breaking something using the ts.add_package_pat= h. I've also tried to mangle with package.path variable with the same outco= me. >> > >> > What am I doing wrong and how should I do to add those new packages? >> > >> > Cheers, >> > >> > Eric >> >