You are not logged in.

#1 2017-04-05 11:42:56

mufeed2000
Member
Registered: 2017-04-05
Posts: 22

[kind-of-SOLVED] dict is slow and uses network unnecessarily

Hi,
I recently re-installed Arch after a tragic ransomware attack (thanks windows). All data was safely recovered without needing to pay the ransom (honest thanks to TestDisk).
The issue now is with dictd's client dict. I use only 'dict' and do not wish to switch. But unlike last time, i have a serious issue with dict and dict-wn. dict-wn should work as it did the last few times, that is, not using internet at all. But right now, dict uses internet, giving slow results. When, I turn off the networking, it works perfectly fine and fast. But with networking on, i get slow results but still from localhost, which is weird.

dictd.conf:

$ cat /etc/dict/dictd.conf
# dictd configuration file.
# whipped up by michael conrad tilstra <michael@gentoo.org>

# Informational message

# who's allowed.  You might want to change this.
access {
  allow *
}

# Dictionaries are listed below.
database wn {
        data /usr/share/dictd/wn.dict.dz
        index /usr/share/dictd/wn.index
}
# The initrc script scans /usr/lib/dict and adds all of the dictionaries
# it finds here.
#
# The initrc script will delete everything after the the last line and
# replace it with what it finds.  So add all of your things above.
#
# If this is a problem for people, contact me and
# we can work out a different method.
#
#LASTLINE

dict.conf:

$ cat /etc/dict/dict.conf
server localhost
server 127.0.0.1
#server dict.org

Please help me.
Thanks.

Last edited by mufeed2000 (2017-04-09 01:42:47)

Offline

#2 2017-04-05 14:59:03

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 16,853

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

Welcome to the Arch Linux Forums.

I know nothing of dict, but taking a shot in the dark...
Is your host name set correctly?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2017-04-05 17:15:16

mufeed2000
Member
Registered: 2017-04-05
Posts: 22

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

My hostname is set to 'simplegarage'.
dict can in fact work offline. If i turn off wifi, it works as it should. But if i turn on wifi and connect, it takes time and apparently connects to the internet, which it should not be doing.
Thanks

Offline

#4 2017-04-05 18:20:45

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,168

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

Do you get any errors when you run "dictd" ??


Arch is home!
sway rofi qutebrowser vifm vim mutt lizzy pass

Offline

#5 2017-04-06 05:08:09

mufeed2000
Member
Registered: 2017-04-05
Posts: 22

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

Docbroke wrote:

Do you get any errors when you run "dictd" ??

No. dictd is running properly.
The issue appears to be with the client and its config. I think i'm missing something.
An alternative could be used: is there any way to prevent (only) dictd from accessing networking except to Localhost?

Offline

#6 2017-04-06 06:24:33

seth
Member
Registered: 2012-09-03
Posts: 13,080

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

ping -c1 localhost # to see the resolved IP
grep localhost /etc/hosts

Offline

#7 2017-04-06 09:30:05

mufeed2000
Member
Registered: 2017-04-05
Posts: 22

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

seth wrote:

ping -c1 localhost # to see the resolved IP
grep localhost /etc/hosts

$ ping -c1 localhost
PING localhost(localhost.localdomain (::1)) 56 data bytes
64 bytes from localhost.localdomain (::1): icmp_seq=1 ttl=64 time=0.105 ms

--- localhost ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.105/0.105/0.105/0.000 ms
$ grep localhost /etc/hosts
127.0.0.1       localhost.localdomain   localhost
::1             localhost.localdomain   localhost
127.0.1.1       simplegarage.localdomainlocalhost

Is my config wrong?

Last edited by mufeed2000 (2017-04-06 11:31:53)

Offline

#8 2017-04-06 13:00:45

blahhumbug
Member
Registered: 2016-10-08
Posts: 64

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

You might want a space between simplegarage.localdomain and localhost.   But I'm not sure that is the root problem.

Edit: mapping localhost to two different IPs is probably a bad idea though.

Last edited by blahhumbug (2017-04-06 13:11:25)

Offline

#9 2017-04-06 13:45:27

seth
Member
Registered: 2012-09-03
Posts: 13,080

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

Try to swap the order in /etc/dict/dict.conf (might have trouble w/ IPv6 access?)

Offline

#10 2017-04-06 15:06:39

mufeed2000
Member
Registered: 2017-04-05
Posts: 22

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

blahhumbug wrote:

You might want a space between simplegarage.localdomain and localhost.   But I'm not sure that is the root problem.

Edit: mapping localhost to two different IPs is probably a bad idea though.

i put the space. localhost was mapped by default, not by me. should i be removing the second ip?
Edit: tried removing second one. didn't help.

seth wrote:

Try to swap the order in /etc/dict/dict.conf (might have trouble w/ IPv6 access?)

tried. no change.
Edit: BTW, IPv4 solutions are fine, I don't have IPv6.

Last edited by mufeed2000 (2017-04-06 15:09:38)

Offline

#11 2017-04-06 16:10:16

seth
Member
Registered: 2012-09-03
Posts: 13,080

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

Wireshark says dict makes unconditional requests to  alt0.dict.org dictionary-server.dict.org and dict.org, mapping those to 127.0.0.1 in /etc/hosts (or dnsmasq) or setting up a resp. IP filter would, errr...., mitigate the problem.
Well, I guess it's 2017 - unconditional internet access is common...

dict also has an -h[ost] and -p[ort] switch, maybe this enforces strict usage *shrug*

Offline

#12 2017-04-06 17:26:56

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,168

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

or ditch and switch to sdcv


Arch is home!
sway rofi qutebrowser vifm vim mutt lizzy pass

Offline

#13 2017-04-06 17:43:34

Texbrew
Member
From: The Lone Star State
Registered: 2016-02-09
Posts: 567

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

Docbroke wrote:

or ditch and switch to sdcv

That's interesting. I have very light Arch installs, and when I run across unfamiliar terms, I search them in my browser. I will be installing sdcv when I get back to an Arch machine.

Offline

#14 2017-04-06 18:23:10

loqs
Member
Registered: 2014-03-06
Posts: 9,235

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

https://git.archlinux.org/svntogit/comm … /dictd#n42

  ./configure --enable-dictorg --prefix=/usr --sysconfdir=/etc/dict --sbindir=/usr/bin

From dictd-1.12.1/dict.c

#ifdef USE_DICT_ORG
      }
      append_command(make_command(CMD_CONNECT,"dict.org",     NULL,user,key));
      append_command(make_command(CMD_CONNECT,"alt0.dict.org",NULL,user,key));
#else
      }else{
	 fprintf (stderr, "'dict.conf' doesn't specify any dict server\n");
	 exit (1);
      }
#endif

Offline

#15 2017-04-06 18:28:06

seth
Member
Registered: 2012-09-03
Posts: 13,080

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

"dict -h localhost" will btw. do (just checked), so you can use an alias or wrapper script up in $PATH

Offline

#16 2017-04-06 23:59:31

mufeed2000
Member
Registered: 2017-04-05
Posts: 22

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

seth wrote:

"dict -h localhost" will btw. do (just checked), so you can use an alias or wrapper script up in $PATH

Tried. Still same result. Weird, i also tried on antergos, same issue. But kde neon, it works fine.

Offline

#17 2017-04-07 00:08:34

mufeed2000
Member
Registered: 2017-04-05
Posts: 22

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

loqs wrote:

https://git.archlinux.org/svntogit/comm … /dictd#n42

  ./configure --enable-dictorg --prefix=/usr --sysconfdir=/etc/dict --sbindir=/usr/bin

From dictd-1.12.1/dict.c

#ifdef USE_DICT_ORG
      }
      append_command(make_command(CMD_CONNECT,"dict.org",     NULL,user,key));
      append_command(make_command(CMD_CONNECT,"alt0.dict.org",NULL,user,key));
#else
      }else{
	 fprintf (stderr, "'dict.conf' doesn't specify any dict server\n");
	 exit (1);
      }
#endif

I guess this is the issue. but adding:

127.0.0.1       alt0.dict.org                    
127.0.0.1       dictionary-server.dict.org          
127.0.0.1       dict.org 

didn't work. Am i doing it wrong?

Offline

#18 2017-04-07 00:48:10

mufeed2000
Member
Registered: 2017-04-05
Posts: 22

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

It is something wrong with my config and not dict. But i can't figure out what.

$ telnet 127.0.0.1 dict

This also lags while network is on and proceeds smoothly when network is off. So, it is something wrong with my networking configuration. The client isn't what is messed up. <or tiny possibility of server messing it up>

Offline

#19 2017-04-07 05:50:28

seth
Member
Registered: 2012-09-03
Posts: 13,080

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

ping 127.0.0.1
tracepath 127.0.0.1
hostnamectl status
iptables -S
ip route
list-unit-files| grep -iE '(net|dhcp|wicd|conn)'
cat /etc/hosts

Offline

#20 2017-04-07 10:46:40

mufeed2000
Member
Registered: 2017-04-05
Posts: 22

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

seth wrote:
ping 127.0.0.1
tracepath 127.0.0.1
hostnamectl status
iptables -S
ip route
list-unit-files| grep -iE '(net|dhcp|wicd|conn)'
cat /etc/hosts

The pinging never ends.

$ ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.054 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.068 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.066 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.066 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.062 ms
64 bytes from 127.0.0.1: icmp_seq=6 ttl=64 time=0.063 ms
64 bytes from 127.0.0.1: icmp_seq=7 ttl=64 time=0.051 ms
64 bytes from 127.0.0.1: icmp_seq=8 ttl=64 time=0.059 ms
64 bytes from 127.0.0.1: icmp_seq=9 ttl=64 time=0.059 ms
64 bytes from 127.0.0.1: icmp_seq=10 ttl=64 time=0.069 ms
64 bytes from 127.0.0.1: icmp_seq=11 ttl=64 time=0.067 ms
64 bytes from 127.0.0.1: icmp_seq=12 ttl=64 time=0.065 ms
64 bytes from 127.0.0.1: icmp_seq=13 ttl=64 time=0.035 ms
64 bytes from 127.0.0.1: icmp_seq=14 ttl=64 time=0.066 ms
64 bytes from 127.0.0.1: icmp_seq=15 ttl=64 time=0.047 ms
64 bytes from 127.0.0.1: icmp_seq=16 ttl=64 time=0.072 ms
64 bytes from 127.0.0.1: icmp_seq=17 ttl=64 time=0.068 ms
64 bytes from 127.0.0.1: icmp_seq=18 ttl=64 time=0.070 ms
64 bytes from 127.0.0.1: icmp_seq=19 ttl=64 time=0.066 ms
64 bytes from 127.0.0.1: icmp_seq=20 ttl=64 time=0.071 ms
64 bytes from 127.0.0.1: icmp_seq=21 ttl=64 time=0.039 ms
.......

and so on... its at icmp_seq=950 now.

$ tracepath 127.0.0.1
 1:  localhost.localdomain                                 0.933ms reached
     Resume: pmtu 65535 hops 1 back 1

$ hostnamectl status
   Static hostname: simplegarage
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: 89066b1d8d6649b38767874016537ddd
           Boot ID: 0942e73942114738b0317ecb6bcadb9f
  Operating System: Arch Linux
            Kernel: Linux 4.10.8-1-ARCH
      Architecture: x86-64

$ sudo iptables -S
[sudo] password for nightglare:
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT

$ ip route
default via 192.168.8.1 dev wlp2s0 proto static metric 600
192.168.8.0/24 dev wlp2s0 proto kernel scope link src 192.168.8.100 metric 600

$ systemctl list-unit-files| grep -iE '(net|dhcp|wicd|conn)'
org.freedesktop.network1.busname            static
sys-fs-fuse-connections.mount               static
dbus-org.freedesktop.network1.service       disabled
dbus-org.freedesktop.NetworkManager.service enabled
dhcpcd.service                              disabled
dhcpcd@.service                             disabled
netctl-auto@.service                        disabled
netctl-ifplugd@.service                     disabled
netctl-sleep.service                        disabled
netctl.service                              disabled
netctl@.service                             static
NetworkManager-dispatcher.service           enabled
NetworkManager-wait-online.service          disabled
NetworkManager.service                      enabled
systemd-networkd-wait-online.service        disabled
systemd-networkd.service                    disabled
telnet@.service                             static
systemd-networkd.socket                     disabled
telnet.socket                               disabled
network-online.target                       static
network-pre.target                          static
network.target                              static


$ cat /etc/hosts
#
# /etc/hosts: static lookup table for host names
#

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost.localdomain   localhost
::1             localhost.localdomain   localhost
127.0.1.1       simplegarage.localdomain localhost
127.0.0.1       alt0.dict.org
127.0.0.1       dictionary-server.dict.org
127.0.0.1       dict.org

# End of file

I coudn't run iptables as regular user. So, i ran it as root. Is that wrong?

Last edited by mufeed2000 (2017-04-07 10:49:43)

Offline

#21 2017-04-07 11:11:17

mufeed2000
Member
Registered: 2017-04-05
Posts: 22

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

I have also tried re-building dictd without the '--enable-dictorg' flag. It still doesn't work.

Offline

#22 2017-04-07 13:47:27

seth
Member
Registered: 2012-09-03
Posts: 13,080

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

It's normal that ping never ends, sorry (-c1 would stop after one call)
Tracepath doesn't leave the machine
Hostname is set
IP tables is empty (yes, UID0 is mandatory - it's your "personal firewall" ... in a way ;-)
Routing is ordinary
You're using networkmanager (and nothing else)
Your hosts file is unsuspicious
The '--enable-dictorg' switch only affects the dict client
Since you figured telnet is slow when being online so it's not the client for sure.

=> WordNets fault? What if you just use a different dictionary (eg. dict-freedict-deu-eng from AUR)?

Offline

#23 2017-04-07 16:45:15

mufeed2000
Member
Registered: 2017-04-05
Posts: 22

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

seth wrote:

It's normal that ping never ends, sorry (-c1 would stop after one call)
Tracepath doesn't leave the machine
Hostname is set
IP tables is empty (yes, UID0 is mandatory - it's your "personal firewall" ... in a way ;-)
Routing is ordinary
You're using networkmanager (and nothing else)
Your hosts file is unsuspicious
The '--enable-dictorg' switch only affects the dict client
Since you figured telnet is slow when being online so it's not the client for sure.

=> WordNets fault? What if you just use a different dictionary (eg. dict-freedict-deu-eng from AUR)?

Something weird just happened. I uninstalled dict-wn and installed dict-foldoc to do the test you suggested.
When I tried to use dict with foldoc, it didn't work, saying it didn't exist. running with '-D' showed 'WordNet' instead. o.o
Then i tried searching 'dict -d wn word'. it works perfectly, just as it should.
I'm guessing it was whatever config edit dict-wn did and dict-foldoc reversed.
What is truly weird is that i supposedly uninstalled WordNet and yet it is the one that works.

Offline

#24 2017-04-07 17:03:02

seth
Member
Registered: 2012-09-03
Posts: 13,080

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

How did you install dict-wn, AUR?
(The explicit mention in the config should not have been required because the dictd init script auto-adds everything in /usr/share/dictd/ and also, as you mentioned, it's weird that it's still available despite supposingly being uninstalled)

Offline

#25 2017-04-08 00:14:06

mufeed2000
Member
Registered: 2017-04-05
Posts: 22

Re: [kind-of-SOLVED] dict is slow and uses network unnecessarily

seth wrote:

How did you install dict-wn, AUR?
(The explicit mention in the config should not have been required because the dictd init script auto-adds everything in /usr/share/dictd/ and also, as you mentioned, it's weird that it's still available despite supposingly being uninstalled)

After a restart, dict now fails to connect to server.

Offline

Board footer

Powered by FluxBB