v 8.1.21
using the ftplib.FTP_TLS() library, I'm writing two files. Seems to be working okay, but get the following warining entry in the log. Two entries at a time, so I'm guessing one for each file. Let me know if there's something obvious I'm missing.
java.lang.NullPointerException: null
at org.python.netty.handler.ssl.SslHandler.wrapAndFlush(SslHandler.java:781)
at org.python.netty.handler.ssl.SslHandler.flush(SslHandler.java:773)
at org.python.netty.handler.ssl.SslHandler.flush(SslHandler.java:1878)
at org.python.netty.handler.ssl.SslHandler.closeOutbound0(SslHandler.java:667)
at org.python.netty.handler.ssl.SslHandler.access$500(SslHandler.java:166)
at org.python.netty.handler.ssl.SslHandler$1.run(SslHandler.java:656)
at org.python.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at org.python.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at org.python.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at org.python.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at org.python.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.base/java.lang.Thread.run(Unknown Source)
def toFTP():
from ftplib import FTP_TLS
import csv
from StringIO import StringIO
logger = system.util.getLogger('Sequencing_toFTP')
lines = [6401, 6402]
# SET file names
now = system.date.now()
nowFormatted = system.date.format(now,'YYDDDHHmm')
csvFileName = '{}.serial_master.csv'.format(nowFormatted)
doneFileName = '{}.done'.format(nowFormatted)
csvData = StringIO()
# This file must stay as a zero length file.
doneData = StringIO()
query = 'SELECT * from myTable where some_conlumn = 0'
dataIn = system.db.runQuery(query, 'Production')
if len(dataIn) > 0:
writer = csv.writer(csvData, lineterminator='\n')
writer.writerow(list(dataIn.getColumnNames()))
writer.writerows(dataIn)
csvData.seek(0)
server = 'ftp.server.com'
username = 'myUser'
password = 'myPassword'
path = '/path/to/store/file'
ftps= FTP_TLS(server)
ftps.login(username, password)
ftps.prot_p()
ftps.cwd(path)
ftps.storlines('STOR {}'.format(csvFileName), csvData)
csvData.close()
ftps.storlines('STOR {}'.format(doneFileName), doneData)
doneData.close()
ftps.close()
serialList = dataIn.getColumnAsList(dataIn.getColumnNames().indexOf('SerialNumber'))
for line in lines:
query = 'UPDATE myTab SET some_column = 1 '
system.db.runUpdateQuery(query, 'Production')
logger.info('Successfully wrote {} with {} serials'.format(csvFileName, len(dataIn)))
else:
logger.info('No serials to process')
It's probably just a bug in the (probably quite old) shadowed version of Netty included into Jython. If you're not noticing any side effects, probably safe to ignore? Might want to double check for socket leaks or anything like that.
Thanks, Paul. Looks ok, just more of an annoyance than an issue.
EDIT: tried wrapping this in a block but it just made one very long line. 
Whelp, This popped up this morningfrom org.python.netty.util.ResourceLeakDetector:
LEAK: ByteBuf.release() was not called before it's garbage-collected. See Netty.docs: Reference counted objects for more information. Recent access records: Created at: org.python.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:349) org.python.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:187) org.python.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:178) org.python.netty.buffer.AbstractByteBufAllocator.buffer(AbstractByteBufAllocator.java:115) org.python.netty.handler.ssl.SslHandler.allocate(SslHandler.java:2136) org.python.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1319) org.python.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1219) org.python.netty.handler.ssl.SslHandler.decode(SslHandler.java:1266) org.python.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:498) org.python.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:437) org.python.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) org.python.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377) org.python.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) org.python.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355) org.python.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) org.python.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377) org.python.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363) org.python.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) org.python.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) org.python.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714) org.python.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650) org.python.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576) org.python.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) org.python.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) org.python.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) java.base/java.lang.Thread.run(Unknown Source)